svn commit: samba r7275 - in trunk/source/nsswitch: .

vlendec at samba.org vlendec at samba.org
Sat Jun 4 16:05:59 GMT 2005


Author: vlendec
Date: 2005-06-04 16:05:58 +0000 (Sat, 04 Jun 2005)
New Revision: 7275

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7275

Log:
Little cleanup work:

find_our_domain panics or returns != NULL, so there's no point checking that.

TALLOC_ZERO_P -> TALLOC_P where we initialize anyway later.

async_request can't be called without a continuation.

Volker

Modified:
   trunk/source/nsswitch/winbindd_async.c
   trunk/source/nsswitch/winbindd_dual.c
   trunk/source/nsswitch/winbindd_misc.c
   trunk/source/nsswitch/winbindd_util.c


Changeset:
Modified: trunk/source/nsswitch/winbindd_async.c
===================================================================
--- trunk/source/nsswitch/winbindd_async.c	2005-06-04 13:57:52 UTC (rev 7274)
+++ trunk/source/nsswitch/winbindd_async.c	2005-06-04 16:05:58 UTC (rev 7275)
@@ -66,7 +66,7 @@
 {
 	struct do_async_state *state;
 
-	state = TALLOC_ZERO_P(mem_ctx, struct do_async_state);
+	state = TALLOC_P(mem_ctx, struct do_async_state);
 	if (state == NULL) {
 		DEBUG(0, ("talloc failed\n"));
 		cont(mem_ctx, False, NULL, c, private);
@@ -93,7 +93,7 @@
 {
 	struct do_async_state *state;
 
-	state = TALLOC_ZERO_P(mem_ctx, struct do_async_state);
+	state = TALLOC_P(mem_ctx, struct do_async_state);
 	if (state == NULL) {
 		DEBUG(0, ("talloc failed\n"));
 		cont(mem_ctx, False, NULL, c, private);

Modified: trunk/source/nsswitch/winbindd_dual.c
===================================================================
--- trunk/source/nsswitch/winbindd_dual.c	2005-06-04 13:57:52 UTC (rev 7274)
+++ trunk/source/nsswitch/winbindd_dual.c	2005-06-04 16:05:58 UTC (rev 7275)
@@ -4,7 +4,7 @@
    Winbind background daemon
 
    Copyright (C) Andrew Tridgell 2002
-   Copyright (C) Volker Lendecke 2004
+   Copyright (C) Volker Lendecke 2004,2005
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -64,7 +64,9 @@
 		 (char *)&state->request, 
 		 sizeof(state->request) - state->read_buf_len);
 	
-	DEBUG(10,("client_read: read %d bytes. Need %ld more for a full request.\n", n, (unsigned long)(sizeof(state->request) - n - state->read_buf_len) ));
+	DEBUG(10,("client_read: read %d bytes. Need %ld more for a full "
+		  "request.\n", n, (unsigned long)(sizeof(state->request) - n -
+						   state->read_buf_len) ));
 
 	/* Read failed, kill client */
 	
@@ -273,6 +275,8 @@
 {
 	struct winbindd_async_request *state, *tmp;
 
+	SMB_ASSERT(continuation != NULL);
+
 	state = TALLOC_P(mem_ctx, struct winbindd_async_request);
 
 	if (state == NULL) {
@@ -338,8 +342,7 @@
 
 	schedule_async_request(child);
 
-	if (state->continuation != NULL)
-		state->continuation(state->private, True);
+	state->continuation(state->private, True);
 }
 
 static void schedule_async_request(struct winbindd_child *child)

Modified: trunk/source/nsswitch/winbindd_misc.c
===================================================================
--- trunk/source/nsswitch/winbindd_misc.c	2005-06-04 13:57:52 UTC (rev 7274)
+++ trunk/source/nsswitch/winbindd_misc.c	2005-06-04 16:05:58 UTC (rev 7275)
@@ -31,18 +31,10 @@
 
 enum winbindd_result winbindd_check_machine_acct(struct winbindd_cli_state *state)
 {
-	struct winbindd_domain *domain;
-
 	DEBUG(3, ("[%5lu]: check machine account\n",
 		  (unsigned long)state->pid));
 
-	domain = find_our_domain();
-	if (domain == NULL) {
-		DEBUG(0, ("Could not find our domain\n"));
-		return WINBINDD_ERROR;
-	}
-
-	async_domain_request(state->mem_ctx, domain,
+	async_domain_request(state->mem_ctx, find_our_domain(),
 			     &state->request, &state->response,
 			     request_finished_cont, state);
 	return WINBINDD_PENDING;
@@ -115,14 +107,10 @@
 
 enum winbindd_result winbindd_list_trusted_domains(struct winbindd_cli_state *state)
 {
-	struct winbindd_domain *domain;
-
 	DEBUG(3, ("[%5lu]: list trusted domains\n",
 		  (unsigned long)state->pid));
 
-	domain = find_our_domain();
-
-	async_domain_request(state->mem_ctx, domain,
+	async_domain_request(state->mem_ctx, find_our_domain(),
 			     &state->request, &state->response,
 			     request_finished_cont, state);
 	return WINBINDD_PENDING;
@@ -173,22 +161,13 @@
 
 enum winbindd_result winbindd_getdcname(struct winbindd_cli_state *state)
 {
-	struct winbindd_domain *domain;
-
 	state->request.domain_name
 		[sizeof(state->request.domain_name)-1] = '\0';
 
 	DEBUG(3, ("[%5lu]: Get DC name for %s\n", (unsigned long)state->pid,
 		  state->request.domain_name));
 
-	domain = find_our_domain();
-
-	if (domain == NULL) {
-		DEBUG(0, ("Could not find our domain\n"));
-		return WINBINDD_ERROR;
-	}
-
-	async_domain_request(state->mem_ctx, domain,
+	async_domain_request(state->mem_ctx, find_our_domain(),
 			     &state->request, &state->response,
 			     request_finished_cont, state);
 	return WINBINDD_PENDING;

Modified: trunk/source/nsswitch/winbindd_util.c
===================================================================
--- trunk/source/nsswitch/winbindd_util.c	2005-06-04 13:57:52 UTC (rev 7274)
+++ trunk/source/nsswitch/winbindd_util.c	2005-06-04 16:05:58 UTC (rev 7275)
@@ -327,7 +327,6 @@
 	struct winbindd_request *request;
 	struct winbindd_response *response;
 	struct init_child_state *state;
-	struct winbindd_domain *our_domain;
 
 	mem_ctx = talloc_init("init_child_connection");
 	if (mem_ctx == NULL) {
@@ -372,13 +371,7 @@
 	request->cmd = WINBINDD_GETDCNAME;
 	fstrcpy(request->domain_name, domain->name);
 
-	our_domain = find_our_domain();
-	if (our_domain == NULL) {
-		DEBUG(5, ("Could not find our domain\n"));
-		return WINBINDD_ERROR;
-	}
-
-	async_domain_request(mem_ctx, our_domain, request, response,
+	async_domain_request(mem_ctx, find_our_domain(), request, response,
 			     init_child_getdc_recv, state);
 	return WINBINDD_PENDING;
 }



More information about the samba-cvs mailing list