[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-126-gb7f34e7

Derrell Lipman derrell.lipman at unwireduniverse.com
Thu Mar 6 15:42:25 GMT 2008


The branch, v3-2-test has been updated
       via  b7f34e7ef2907b498a0645ce68f2773ed7d60cdc (commit)
      from  e473e6d50c56f52ef5e4853e4ca3b3548af06f51 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit b7f34e7ef2907b498a0645ce68f2773ed7d60cdc
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Thu Mar 6 10:41:42 2008 -0500

    Eliminate global variable in_client and a plethora of extern declarations.
    
    Derrell

-----------------------------------------------------------------------

Summary of changes:
 source/client/client.c              |    3 +--
 source/client/smbspool.c            |    3 +--
 source/libsmb/libsmb_context.c      |    4 +---
 source/pam_smbpass/pam_smb_acct.c   |    3 +--
 source/pam_smbpass/pam_smb_auth.c   |    3 +--
 source/pam_smbpass/pam_smb_passwd.c |    4 +---
 source/param/loadparm.c             |   25 +++++++++++++++++++++++--
 source/param/params.c               |    4 +---
 8 files changed, 30 insertions(+), 19 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/client.c b/source/client/client.c
index 79b7dfe..67060cb 100644
--- a/source/client/client.c
+++ b/source/client/client.c
@@ -33,7 +33,6 @@ extern int do_smb_browse(void); /* mDNS browsing */
 extern bool AllowDebugChange;
 extern bool override_logfile;
 extern char tar_type;
-extern bool in_client;
 
 static int port = 0;
 static char *service;
@@ -4701,7 +4700,7 @@ static int do_message_op(void)
 	pc = poptGetContext("smbclient", argc, (const char **) argv, long_options, 0);
 	poptSetOtherOptionHelp(pc, "service <password>");
 
-	in_client = true;   /* Make sure that we tell lp_load we are */
+        lp_set_in_client(true); /* Make sure that we tell lp_load we are */
 
 	while ((opt = poptGetNextOpt(pc)) != -1) {
 
diff --git a/source/client/smbspool.c b/source/client/smbspool.c
index e7df22c..e827df4 100644
--- a/source/client/smbspool.c
+++ b/source/client/smbspool.c
@@ -35,7 +35,6 @@
  * Globals...
  */
 
-extern bool		in_client;	/* Boolean for client library */
 
 
 /*
@@ -228,7 +227,7 @@ static bool smb_encrypt;
 
   setup_logging("smbspool", True);
 
-  in_client = True;   /* Make sure that we tell lp_load we are */
+  lp_set_in_client(True);       /* Make sure that we tell lp_load we are */
 
   load_case_tables();
 
diff --git a/source/libsmb/libsmb_context.c b/source/libsmb/libsmb_context.c
index 212b42f..3e67943 100644
--- a/source/libsmb/libsmb_context.c
+++ b/source/libsmb/libsmb_context.c
@@ -27,8 +27,6 @@
 #include "libsmb_internal.h"
 
 
-extern bool in_client;
-
 /*
  * Is the logging working / configfile read ? 
  */
@@ -450,7 +448,7 @@ smbc_init_context(SMBCCTX *context)
                 
                 /* Here we would open the smb.conf file if needed ... */
                 
-                in_client = True; /* FIXME, make a param */
+                lp_set_in_client(True);
                 
                 home = getenv("HOME");
                 if (home) {
diff --git a/source/pam_smbpass/pam_smb_acct.c b/source/pam_smbpass/pam_smb_acct.c
index b9bcb31..2a8bd26 100644
--- a/source/pam_smbpass/pam_smb_acct.c
+++ b/source/pam_smbpass/pam_smb_acct.c
@@ -55,12 +55,11 @@ int pam_sm_acct_mgmt( pam_handle_t *pamh, int flags,
 	const char *name;
 	struct samu *sampass = NULL;
 	void (*oldsig_handler)(int);
-	extern bool in_client;
 
 	/* Samba initialization. */
 	load_case_tables();
 	setup_logging( "pam_smbpass", False );
-	in_client = True;
+        lp_set_in_client(True);
 
 	ctrl = set_ctrl( flags, argc, argv );
 
diff --git a/source/pam_smbpass/pam_smb_auth.c b/source/pam_smbpass/pam_smb_auth.c
index 3a841ad..3dceb52 100644
--- a/source/pam_smbpass/pam_smb_auth.c
+++ b/source/pam_smbpass/pam_smb_auth.c
@@ -72,7 +72,6 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
 	unsigned int ctrl;
 	int retval, *ret_data = NULL;
 	struct samu *sampass = NULL;
-	extern bool in_client;
 	const char *name;
 	void (*oldsig_handler)(int) = NULL;
 	bool found;
@@ -83,7 +82,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
 	/* Samba initialization. */
 	load_case_tables();
 	setup_logging("pam_smbpass",False);
-	in_client = True;
+        lp_set_in_client(True);
 
 	ctrl = set_ctrl(flags, argc, argv);
 
diff --git a/source/pam_smbpass/pam_smb_passwd.c b/source/pam_smbpass/pam_smb_passwd.c
index 326a0b5..b6de43f 100644
--- a/source/pam_smbpass/pam_smb_passwd.c
+++ b/source/pam_smbpass/pam_smb_passwd.c
@@ -98,8 +98,6 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
     unsigned int ctrl;
     int retval;
 
-    extern bool in_client;
-
     struct samu *sampass = NULL;
     void (*oldsig_handler)(int);
     const char *user;
@@ -109,7 +107,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
     /* Samba initialization. */
     load_case_tables();
     setup_logging( "pam_smbpass", False );
-    in_client = True;
+    lp_set_in_client(True);
 
     ctrl = set_ctrl(flags, argc, argv);
 
diff --git a/source/param/loadparm.c b/source/param/loadparm.c
index 25aa48b..833ca54 100644
--- a/source/param/loadparm.c
+++ b/source/param/loadparm.c
@@ -54,7 +54,6 @@
 #include "includes.h"
 #include "libnet/libnet.h"
 
-bool in_client = False;		/* Not in the client by default */
 bool bLoaded = False;
 
 extern enum protocol_types Protocol;
@@ -72,6 +71,7 @@ extern userdom_struct current_user_info;
 #define HOMES_NAME "homes"
 #endif
 
+static bool in_client = False;		/* Not in the client by default */
 static uint64_t conf_last_seqnum = 0;
 static struct libnet_conf_ctx *conf_ctx = NULL;
 
@@ -5502,6 +5502,27 @@ void gfree_loadparm(void)
 	}
 }
 
+
+/***************************************************************************
+ Allow client apps to specify that they are a client
+***************************************************************************/
+void lp_set_in_client(bool b)
+{
+    in_client = b;
+}
+
+
+/***************************************************************************
+ Determine if we're running in a client app
+***************************************************************************/
+bool lp_is_in_client(void)
+{
+    return in_client;
+}
+
+
+
+
 /***************************************************************************
  Load the services array from the services file. Return True on success, 
  False on failure.
@@ -5608,7 +5629,7 @@ bool lp_load(const char *pszFname,
 
 	/* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
 	/* if bWINSsupport is true and we are in the client            */
-	if (in_client && Globals.bWINSsupport) {
+	if (lp_is_in_client() && Globals.bWINSsupport) {
 		lp_do_parameter(GLOBAL_SECTION_SNUM, "wins server", "127.0.0.1");
 	}
 
diff --git a/source/param/params.c b/source/param/params.c
index 44b44d9..e69715e 100644
--- a/source/param/params.c
+++ b/source/param/params.c
@@ -80,8 +80,6 @@
 
 #include "includes.h"
 
-extern bool in_client;
-
 /* -------------------------------------------------------------------------- **
  * Constants...
  */
@@ -519,7 +517,7 @@ static bool Parse( DATA_BLOB *buf, myFILE *InFile,
 static myFILE *OpenConfFile( const char *FileName )
 {
 	const char *func = "params.c:OpenConfFile() -";
-	int lvl = in_client?1:0;
+	int lvl = lp_is_in_client() ? 1 : 0;
 	myFILE *ret;
 
 	ret = SMB_MALLOC_P(myFILE);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list