svn commit: samba r26266 - in branches/SAMBA_4_0: . source/client source/ldap_server source/lib/events source/lib/messaging/tests source/lib/util source/libcli source/libcli/ldap source/libcli/raw source/libcli/smb2 source/libcli/smb_composite source/librpc/rpc source/torture/basic

jelmer at samba.org jelmer at samba.org
Mon Dec 3 21:25:09 GMT 2007


Author: jelmer
Date: 2007-12-03 21:25:06 +0000 (Mon, 03 Dec 2007)
New Revision: 26266

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

Log:
Remove more global_loadparm uses.
Removed:
   branches/SAMBA_4_0/source/lib/util/util_ldb.h
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/client/client.c
   branches/SAMBA_4_0/source/ldap_server/ldap_backend.c
   branches/SAMBA_4_0/source/ldap_server/ldap_bind.c
   branches/SAMBA_4_0/source/ldap_server/ldap_server.c
   branches/SAMBA_4_0/source/ldap_server/ldap_server.h
   branches/SAMBA_4_0/source/lib/events/events.c
   branches/SAMBA_4_0/source/lib/messaging/tests/irpc.c
   branches/SAMBA_4_0/source/lib/messaging/tests/messaging.c
   branches/SAMBA_4_0/source/libcli/cliconnect.c
   branches/SAMBA_4_0/source/libcli/ldap/ldap_client.c
   branches/SAMBA_4_0/source/libcli/raw/clisocket.c
   branches/SAMBA_4_0/source/libcli/raw/clitransport.c
   branches/SAMBA_4_0/source/libcli/smb2/connect.c
   branches/SAMBA_4_0/source/libcli/smb_composite/connect.c
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc_connect.c
   branches/SAMBA_4_0/source/torture/basic/base.c


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/client/client.c
===================================================================
--- branches/SAMBA_4_0/source/client/client.c	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/client/client.c	2007-12-03 21:25:06 UTC (rev 26266)
@@ -3078,7 +3078,7 @@
 
 	server_name = destip ? destip : desthost;
 
-	if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name)) {
+	if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name, lp_name_resolve_order(global_loadparm), lp_max_xmit(global_loadparm), lp_maxmux(global_loadparm))) {
 		d_printf("Connection to %s failed\n", server_name);
 		return 1;
 	}

Modified: branches/SAMBA_4_0/source/ldap_server/ldap_backend.c
===================================================================
--- branches/SAMBA_4_0/source/ldap_server/ldap_backend.c	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/ldap_server/ldap_backend.c	2007-12-03 21:25:06 UTC (rev 26266)
@@ -56,8 +56,9 @@
 NTSTATUS ldapsrv_backend_Init(struct ldapsrv_connection *conn) 
 {
 	conn->ldb = ldb_wrap_connect(conn, 
-				     global_loadparm,
-				     lp_sam_url(global_loadparm), conn->session_info,
+				     conn->lp_ctx,
+				     lp_sam_url(conn->lp_ctx), 
+				     conn->session_info,
 				     NULL, conn->global_catalog ? LDB_FLG_RDONLY : 0, NULL);
 	if (conn->ldb == NULL) {
 		return NT_STATUS_INTERNAL_DB_CORRUPTION;

Modified: branches/SAMBA_4_0/source/ldap_server/ldap_bind.c
===================================================================
--- branches/SAMBA_4_0/source/ldap_server/ldap_bind.c	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/ldap_server/ldap_bind.c	2007-12-03 21:25:06 UTC (rev 26266)
@@ -45,12 +45,12 @@
 
 	DEBUG(10, ("BindSimple dn: %s\n",req->dn));
 
-	status = crack_auto_name_to_nt4_name(call, global_loadparm, req->dn, &nt4_domain, &nt4_account);
+	status = crack_auto_name_to_nt4_name(call, call->conn->lp_ctx, req->dn, &nt4_domain, &nt4_account);
 	if (NT_STATUS_IS_OK(status)) {
 		status = authenticate_username_pw(call,
 						  call->conn->connection->event.ctx,
 						  call->conn->connection->msg_ctx,
-						  global_loadparm,
+						  call->conn->lp_ctx,
 						  nt4_domain, nt4_account, 
 						  req->creds.password,
 						  &session_info);
@@ -143,7 +143,7 @@
 
 		status = gensec_server_start(conn,
 					     conn->connection->event.ctx,
-					     global_loadparm,
+					     conn->lp_ctx,
 					     conn->connection->msg_ctx,
 					     &conn->gensec);
 		if (!NT_STATUS_IS_OK(status)) {

Modified: branches/SAMBA_4_0/source/ldap_server/ldap_server.c
===================================================================
--- branches/SAMBA_4_0/source/ldap_server/ldap_server.c	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/ldap_server/ldap_server.c	2007-12-03 21:25:06 UTC (rev 26266)
@@ -345,6 +345,7 @@
 	conn->connection  = c;
 	conn->service     = ldapsrv_service;
 	conn->sockets.raw = c->socket;
+	conn->lp_ctx      = global_loadparm;
 
 	c->private        = conn;
 
@@ -395,7 +396,7 @@
 		return;
 	}
 	
-	cli_credentials_set_conf(server_credentials, global_loadparm);
+	cli_credentials_set_conf(server_credentials, conn->lp_ctx);
 	status = cli_credentials_set_machine_account(server_credentials);
 	if (!NT_STATUS_IS_OK(status)) {
 		stream_terminate_connection(c, talloc_asprintf(conn, "Failed to obtain server credentials, perhaps a standalone server?: %s\n", nt_errstr(status)));
@@ -404,7 +405,7 @@
 	conn->server_credentials = server_credentials;
 
 	/* Connections start out anonymous */
-	if (!NT_STATUS_IS_OK(auth_anonymous_session_info(conn, global_loadparm, &conn->session_info))) {
+	if (!NT_STATUS_IS_OK(auth_anonymous_session_info(conn, conn->lp_ctx, &conn->session_info))) {
 		ldapsrv_terminate_connection(conn, "failed to setup anonymous session info");
 		return;
 	}

Modified: branches/SAMBA_4_0/source/ldap_server/ldap_server.h
===================================================================
--- branches/SAMBA_4_0/source/ldap_server/ldap_server.h	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/ldap_server/ldap_server.h	2007-12-03 21:25:06 UTC (rev 26266)
@@ -23,6 +23,7 @@
 #include "lib/stream/packet.h"
 
 struct ldapsrv_connection {
+	struct loadparm_context *lp_ctx;
 	struct stream_connection *connection;
 	struct gensec_security *gensec;
 	struct auth_session_info *session_info;

Modified: branches/SAMBA_4_0/source/lib/events/events.c
===================================================================
--- branches/SAMBA_4_0/source/lib/events/events.c	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/lib/events/events.c	2007-12-03 21:25:06 UTC (rev 26266)
@@ -183,12 +183,7 @@
 
 	event_backend_init();
 
-#if _SAMBA_BUILD_
 	if (name == NULL) {
-		name = lp_parm_string(global_loadparm, NULL, "event", "backend");
-	}
-#endif
-	if (name == NULL) {
 		name = event_default_backend;
 	}
 	if (name == NULL) {

Modified: branches/SAMBA_4_0/source/lib/messaging/tests/irpc.c
===================================================================
--- branches/SAMBA_4_0/source/lib/messaging/tests/irpc.c	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/lib/messaging/tests/irpc.c	2007-12-03 21:25:06 UTC (rev 26266)
@@ -215,12 +215,12 @@
 
 	*_data = data = talloc(tctx, struct irpc_test_data);
 
-	lp_set_cmdline(global_loadparm, "pid directory", "piddir.tmp");
+	lp_set_cmdline(tctx->lp_ctx, "pid directory", "piddir.tmp");
 
 	data->ev = tctx->ev;
 	torture_assert(tctx, data->msg_ctx1 = 
 		       messaging_init(tctx, 
-				      lp_messaging_path(tctx, global_loadparm), 
+				      lp_messaging_path(tctx, tctx->lp_ctx), 
 				      cluster_id(MSG_ID1), data->ev),
 		       "Failed to init first messaging context");
 

Modified: branches/SAMBA_4_0/source/lib/messaging/tests/messaging.c
===================================================================
--- branches/SAMBA_4_0/source/lib/messaging/tests/messaging.c	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/lib/messaging/tests/messaging.c	2007-12-03 21:25:06 UTC (rev 26266)
@@ -66,23 +66,22 @@
 	struct timeval tv;
 	int timelimit = torture_setting_int(tctx, "timelimit", 10);
 	uint32_t msg_ping, msg_exit;
-	TALLOC_CTX *mem_ctx = tctx;
 
-	lp_set_cmdline(global_loadparm, "pid directory", "piddir.tmp");
+	lp_set_cmdline(tctx->lp_ctx, "pid directory", "piddir.tmp");
 
 	ev = tctx->ev;
 
-	msg_server_ctx = messaging_init(mem_ctx, 
-					lp_messaging_path(tctx, global_loadparm), 
+	msg_server_ctx = messaging_init(tctx, 
+					lp_messaging_path(tctx, tctx->lp_ctx), 
 					cluster_id(1), ev);
 	
 	torture_assert(tctx, msg_server_ctx != NULL, "Failed to init ping messaging context");
 		
 	messaging_register_tmp(msg_server_ctx, NULL, ping_message, &msg_ping);
-	messaging_register_tmp(msg_server_ctx, mem_ctx, exit_message, &msg_exit);
+	messaging_register_tmp(msg_server_ctx, tctx, exit_message, &msg_exit);
 
-	msg_client_ctx = messaging_init(mem_ctx, 
-					lp_messaging_path(mem_ctx, global_loadparm), 
+	msg_client_ctx = messaging_init(tctx, 
+					lp_messaging_path(tctx, tctx->lp_ctx), 
 					cluster_id(2), ev);
 
 	torture_assert(tctx, msg_client_ctx != NULL, 

Deleted: branches/SAMBA_4_0/source/lib/util/util_ldb.h
===================================================================
--- branches/SAMBA_4_0/source/lib/util/util_ldb.h	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/lib/util/util_ldb.h	2007-12-03 21:25:06 UTC (rev 26266)
@@ -1,55 +0,0 @@
-#ifndef __LIB_UTIL_UTIL_LDB_H__
-#define __LIB_UTIL_UTIL_LDB_H__
-
-#undef _PRINTF_ATTRIBUTE
-#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2)
-/* This file was automatically generated by mkproto.pl. DO NOT EDIT */
-
-#ifndef _PUBLIC_
-#define _PUBLIC_
-#endif
-
-#ifndef _PURE_
-#define _PURE_
-#endif
-
-#ifndef _NORETURN_
-#define _NORETURN_
-#endif
-
-#ifndef _DEPRECATED_
-#define _DEPRECATED_
-#endif
-
-#ifndef _WARN_UNUSED_RESULT_
-#define _WARN_UNUSED_RESULT_
-#endif
-
-
-/* The following definitions come from lib/util/util_ldb.c  */
-
-int gendb_search_v(struct ldb_context *ldb, 
-		   TALLOC_CTX *mem_ctx,
-		   struct ldb_dn *basedn,
-		   struct ldb_message ***msgs,
-		   const char * const *attrs,
-		   const char *format, 
-		   va_list ap)  _PRINTF_ATTRIBUTE(6,0);
-int gendb_search(struct ldb_context *ldb,
-		 TALLOC_CTX *mem_ctx, 
-		 struct ldb_dn *basedn,
-		 struct ldb_message ***res,
-		 const char * const *attrs,
-		 const char *format, ...) _PRINTF_ATTRIBUTE(6,7);
-int gendb_search_dn(struct ldb_context *ldb,
-		 TALLOC_CTX *mem_ctx, 
-		 struct ldb_dn *dn,
-		 struct ldb_message ***res,
-		 const char * const *attrs);
-int gendb_add_ldif(struct ldb_context *ldb, const char *ldif_string);
-char *wrap_casefold(void *context, void *mem_ctx, const char *s);
-#undef _PRINTF_ATTRIBUTE
-#define _PRINTF_ATTRIBUTE(a1, a2)
-
-#endif /* __LIB_UTIL_UTIL_LDB_H__ */
-

Modified: branches/SAMBA_4_0/source/libcli/cliconnect.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/cliconnect.c	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/libcli/cliconnect.c	2007-12-03 21:25:06 UTC (rev 26266)
@@ -30,15 +30,19 @@
 /*
   wrapper around smbcli_sock_connect()
 */
-bool smbcli_socket_connect(struct smbcli_state *cli, const char *server)
+bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, 
+			   const char **name_resolve_order,
+			   int max_xmit, int max_mux)
 {
 	struct smbcli_socket *sock;
 
-	sock = smbcli_sock_connect_byname(server, 0, NULL, NULL);
+	sock = smbcli_sock_connect_byname(server, 0, NULL, name_resolve_order, 
+					  NULL);
 
 	if (sock == NULL) return false;
 	
-	cli->transport = smbcli_transport_init(sock, cli, true);
+	cli->transport = smbcli_transport_init(sock, cli, true, max_xmit,
+					       max_mux);
 	if (!cli->transport) {
 		return false;
 	}

Modified: branches/SAMBA_4_0/source/libcli/ldap/ldap_client.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/ldap/ldap_client.c	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/libcli/ldap/ldap_client.c	2007-12-03 21:25:06 UTC (rev 26266)
@@ -377,7 +377,8 @@
 	return NULL;
 }
 
-static void ldap_connect_got_sock(struct composite_context *ctx, struct ldap_connection *conn) 
+static void ldap_connect_got_sock(struct composite_context *ctx, 
+				  struct ldap_connection *conn) 
 {
 	/* setup a handler for events on this socket */
 	conn->event.fde = event_add_fd(conn->event.event_ctx, conn->sock, 

Modified: branches/SAMBA_4_0/source/libcli/raw/clisocket.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/clisocket.c	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/libcli/raw/clisocket.c	2007-12-03 21:25:06 UTC (rev 26266)
@@ -199,6 +199,7 @@
 ****************************************************************************/
 struct smbcli_socket *smbcli_sock_connect_byname(const char *host, int port,
 						 TALLOC_CTX *mem_ctx,
+						 const char **name_resolve_order,
 						 struct event_context *event_ctx)
 {
 	int name_type = NBT_NAME_SERVER;
@@ -239,7 +240,7 @@
 
 	make_nbt_name(&nbt_name, host, name_type);
 	
-	status = resolve_name(&nbt_name, tmp_ctx, &address, event_ctx, lp_name_resolve_order(global_loadparm));
+	status = resolve_name(&nbt_name, tmp_ctx, &address, event_ctx, name_resolve_order);
 	if (!NT_STATUS_IS_OK(status)) {
 		talloc_free(tmp_ctx);
 		return NULL;

Modified: branches/SAMBA_4_0/source/libcli/raw/clitransport.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/clitransport.c	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/libcli/raw/clitransport.c	2007-12-03 21:25:06 UTC (rev 26266)
@@ -73,7 +73,9 @@
 */
 struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock,
 					       TALLOC_CTX *parent_ctx, 
-					       bool primary)
+					       bool primary, 
+					       int max_xmit,
+					       int max_mux)
 {
 	struct smbcli_transport *transport;
 
@@ -88,8 +90,8 @@
 	transport->negotiate.protocol = PROTOCOL_NT1;
 	transport->options.use_spnego = lp_use_spnego(global_loadparm) && 
 		                        lp_nt_status_support(global_loadparm);
-	transport->options.max_xmit = lp_max_xmit(global_loadparm);
-	transport->options.max_mux = lp_maxmux(global_loadparm);
+	transport->options.max_xmit = max_xmit;
+	transport->options.max_mux = max_mux;
 	transport->options.request_timeout = SMB_REQUEST_TIMEOUT;
 
 	transport->negotiate.max_xmit = transport->options.max_xmit;

Modified: branches/SAMBA_4_0/source/libcli/smb2/connect.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/smb2/connect.c	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/libcli/smb2/connect.c	2007-12-03 21:25:06 UTC (rev 26266)
@@ -163,6 +163,7 @@
 struct composite_context *smb2_connect_send(TALLOC_CTX *mem_ctx,
 					    const char *host,
 					    const char *share,
+					    const char **name_resolve_order,
 					    struct cli_credentials *credentials,
 					    struct event_context *ev)
 {
@@ -187,8 +188,7 @@
 	ZERO_STRUCT(name);
 	name.name = host;
 
-	creq = resolve_name_send(&name, c->event_ctx, 
-				 lp_name_resolve_order(global_loadparm));
+	creq = resolve_name_send(&name, c->event_ctx, name_resolve_order);
 	composite_continue(c, creq, continue_resolve, c);
 	return c;
 }
@@ -215,11 +215,13 @@
 */
 NTSTATUS smb2_connect(TALLOC_CTX *mem_ctx, 
 		      const char *host, const char *share,
+		      const char **name_resolve_order,
 		      struct cli_credentials *credentials,
 		      struct smb2_tree **tree,
 		      struct event_context *ev)
 {
 	struct composite_context *c = smb2_connect_send(mem_ctx, host, share, 
+							name_resolve_order,
 							credentials, ev);
 	return smb2_connect_recv(c, mem_ctx, tree);
 }

Modified: branches/SAMBA_4_0/source/libcli/smb_composite/connect.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/smb_composite/connect.c	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/libcli/smb_composite/connect.c	2007-12-03 21:25:06 UTC (rev 26266)
@@ -307,7 +307,9 @@
 	NT_STATUS_NOT_OK_RETURN(status);
 
 	/* the socket is up - we can initialise the smbcli transport layer */
-	state->transport = smbcli_transport_init(state->sock, state, true);
+	state->transport = smbcli_transport_init(state->sock, state, true, 
+						 lp_max_xmit(global_loadparm),
+						 lp_maxmux(global_loadparm));
 	NT_STATUS_HAVE_NO_MEMORY(state->transport);
 
 	if (is_ipaddress(state->sock->hostname) &&

Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_connect.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_connect.c	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_connect.c	2007-12-03 21:25:06 UTC (rev 26266)
@@ -235,7 +235,9 @@
 	}
 
 	/* send smb2 connect request */
-	conn_req = smb2_connect_send(mem_ctx, s->io.binding->host, "IPC$", s->io.creds,
+	conn_req = smb2_connect_send(mem_ctx, s->io.binding->host, "IPC$", 
+				     lp_name_resolve_order(global_loadparm),
+				     s->io.creds,
 				     c->event_ctx);
 	composite_continue(c, conn_req, continue_smb2_connect, c);
 	return c;

Modified: branches/SAMBA_4_0/source/torture/basic/base.c
===================================================================
--- branches/SAMBA_4_0/source/torture/basic/base.c	2007-12-03 18:47:42 UTC (rev 26265)
+++ branches/SAMBA_4_0/source/torture/basic/base.c	2007-12-03 21:25:06 UTC (rev 26266)
@@ -51,7 +51,7 @@
 		goto failed;
 	}
 
-	if (!smbcli_socket_connect(cli, host)) {
+	if (!smbcli_socket_connect(cli, host, lp_name_resolve_order(tctx->lp_ctx), lp_max_xmit(tctx->lp_ctx), lp_maxmux(tctx->lp_ctx))) {
 		torture_comment(tctx, "Failed to connect with %s\n", host);
 		goto failed;
 	}



More information about the samba-cvs mailing list