Make 'remote_machine' private to lib/substitute.c, and fix all the user to use
authorAndrew Bartlett <abartlet@samba.org>
Sun, 11 Aug 2002 02:30:35 +0000 (02:30 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 11 Aug 2002 02:30:35 +0000 (02:30 +0000)
the new accessor functions.

Andrew Bartlett
(This used to be commit f393de2310e997d05674eb7f1268655373e03647)

12 files changed:
source3/auth/auth_util.c
source3/lib/substitute.c
source3/nmbd/nmbd.c
source3/smbd/connection.c
source3/smbd/filename.c
source3/smbd/negprot.c
source3/smbd/password.c
source3/smbd/reply.c
source3/smbd/service.c
source3/smbd/session.c
source3/smbd/sesssetup.c
source3/wrepld/server.c

index 3ade220c0f02878dfb4dea7b244b3cbc9897a592..f914d918715dd7dfc3a7a1e14db91109ee546785 100644 (file)
@@ -25,7 +25,6 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_AUTH
 
-extern fstring remote_machine;
 extern pstring global_myname;
 
 /****************************************************************************
@@ -394,7 +393,7 @@ BOOL make_user_info_for_reply(auth_usersupplied_info **user_info,
        
        ret = make_user_info_map(user_info, smb_name,
                                 client_domain, 
-                                remote_machine,
+                                get_remote_machine_name(),
                                 local_lm_blob,
                                 local_nt_blob,
                                 plaintext_password, 
@@ -429,7 +428,7 @@ BOOL make_user_info_for_reply_enc(auth_usersupplied_info **user_info,
 
        return make_user_info_map(user_info, smb_name, 
                                 client_domain, 
-                                remote_machine
+                                get_remote_machine_name()
                                 lm_resp, 
                                 nt_resp, 
                                 no_plaintext_blob, 
index c47b5914f1df95df8333c070a0cc50fd29ba0f14..026df0f67f1518ae2a76bced7e347f1db855cc9c 100644 (file)
@@ -25,9 +25,11 @@ fstring local_machine="";
 fstring remote_arch="UNKNOWN";
 userdom_struct current_user_info;
 fstring remote_proto="UNKNOWN";
-fstring remote_machine="";
 extern pstring global_myname;
 
+static fstring remote_machine="";
+
+
 void set_local_machine_name(const char* local_name)
 {
        fstring tmp_local_machine;
index 3a0dabe8d717149e67062b48099e51580e422cc7..05ea4997d5fdb0dfdbd1ee25a1d45c426d012ecb 100644 (file)
@@ -269,9 +269,8 @@ static BOOL reload_interfaces(time_t t)
 static BOOL reload_nmbd_services(BOOL test)
 {
        BOOL ret;
-       extern fstring remote_machine;
 
-       fstrcpy( remote_machine, "nmbd" );
+       set_remote_machine_name("nmbd");
 
        if ( lp_loaded() ) {
                pstring fname;
index b53ef9fb3fcf7e2db40ff3823bd9386ca343cd6f..5609c2963d80ce6976f0e378bef9b8cb38f77862 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "includes.h"
 
-extern fstring remote_machine;
 static TDB_CONTEXT *tdb;
 
 /****************************************************************************
@@ -178,7 +177,7 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO
        }
        crec.start = time(NULL);
        
-       StrnCpy(crec.machine,remote_machine,sizeof(crec.machine)-1);
+       StrnCpy(crec.machine,get_remote_machine_name(),sizeof(crec.machine)-1);
        StrnCpy(crec.addr,conn?conn->client_address:client_addr(),sizeof(crec.addr)-1);
 
        dbuf.dptr = (char *)&crec;
index e5f9b7a0ae8588d95177d7dc93cb6968f9e5c385..ce98af4ace5fcc65b8ee552640e34e0082692ce6 100644 (file)
@@ -29,7 +29,6 @@
 extern BOOL case_sensitive;
 extern BOOL case_preserve;
 extern BOOL short_case_preserve;
-extern fstring remote_machine;
 extern BOOL use_mangled_map;
 
 static BOOL scan_directory(char *path, char *name,connection_struct *conn,BOOL docache);
index 1d79cbd5d00b9b22a733555fdb79873d7a6acb99..2be04fd686058f553412aa6cc13efa0d2e190b2e 100644 (file)
@@ -23,7 +23,6 @@
 extern int Protocol;
 extern int max_recv;
 extern fstring global_myworkgroup;
-extern fstring remote_machine;
 BOOL global_encrypted_passwords_negotiated = False;
 BOOL global_spnego_negotiated = False;
 struct auth_context *negprot_global_auth_context = NULL;
index 2558ffe16339deb504bf685fb98e92eafc42f62c..6d922139e703ff725c39e7442a474614a6bab0c1 100644 (file)
@@ -303,7 +303,7 @@ int register_vuid(auth_serversupplied_info *server_info, char *smb_name)
 /****************************************************************************
 add a name to the session users list
 ****************************************************************************/
-void add_session_user(char *user)
+void add_session_user(const char *user)
 {
   fstring suser;
   StrnCpy(suser,user,sizeof(suser)-1);
index a4ed770f314afad5cdd3c219c6de854d0299ebc9..dc49fe3e2e7a7cd56fb708532f07a07fd2c964bb 100644 (file)
@@ -38,7 +38,6 @@ extern pstring global_myname;
 extern int global_oplock_break;
 unsigned int smb_echo_count = 0;
 
-extern fstring remote_machine;
 extern BOOL global_encrypted_passwords_negotiated;
 
 
@@ -108,7 +107,7 @@ int reply_special(char *inbuf,char *outbuf)
                   of possibly valid usernames if we are operating
                   in share mode security */
                if (lp_security() == SEC_SHARE) {
-                       add_session_user(remote_machine);
+                       add_session_user(get_remote_machine_name());
                }
 
                reload_services(True);
index aac90f2fdcfe52c2884068e2aaf4c2015043d8b3..26e00aa49f307f3eabe719799e06c385e9882403 100644 (file)
@@ -27,9 +27,7 @@ extern BOOL short_case_preserve;
 extern BOOL case_mangle;
 extern BOOL case_sensitive;
 extern BOOL use_mangled_map;
-extern fstring remote_machine;
 extern userdom_struct current_user_info;
-extern fstring remote_machine;
 
 
 /****************************************************************************
@@ -636,7 +634,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
           I have disabled this chdir check (tridge) */
        if (vfs_ChDir(conn,conn->connectpath) != 0) {
                DEBUG(0,("%s (%s) Can't change directory to %s (%s)\n",
-                        remote_machine, conn->client_address,
+                        get_remote_machine_name(), conn->client_address,
                         conn->connectpath,strerror(errno)));
                change_to_root_user();
                yield_connection(conn, lp_servicename(SNUM(conn)));
@@ -676,7 +674,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
         */
 
        if( DEBUGLVL( IS_IPC(conn) ? 3 : 1 ) ) {
-               dbgtext( "%s (%s) ", remote_machine, conn->client_address );
+               dbgtext( "%s (%s) ", get_remote_machine_name(), conn->client_address );
                dbgtext( "connect to service %s ", lp_servicename(SNUM(conn)) );
                dbgtext( "initially as user %s ", user );
                dbgtext( "(uid=%d, gid=%d) ", (int)geteuid(), (int)getegid() );
@@ -825,7 +823,7 @@ connection_struct *make_connection(const char *service_in, DATA_BLOB password,
                }
 
                DEBUG(0,("%s (%s) couldn't find service %s\n",
-                        remote_machine, client_addr(), service));
+                        get_remote_machine_name(), client_addr(), service));
                *status = NT_STATUS_BAD_NETWORK_NAME;
                return NULL;
        }
@@ -847,7 +845,7 @@ void close_cnum(connection_struct *conn, uint16 vuid)
        change_to_root_user();
 
        DEBUG(IS_IPC(conn)?3:1, ("%s (%s) closed connection to service %s\n",
-                                remote_machine,conn->client_address,
+                                get_remote_machine_name(),conn->client_address,
                                 lp_servicename(SNUM(conn))));
 
        if (conn->vfs_ops.disconnect != NULL) {
index f7ade5570c376c316631dcc33098c535dfa03c46..54b7a24b070cfca590f0fcfd7cca647d652a3769 100644 (file)
@@ -27,8 +27,6 @@
 
 #include "includes.h"
 
-extern fstring remote_machine;
-
 static TDB_CONTEXT *tdb;
 /* called when a session is created */
 BOOL session_claim(user_struct *vuser)
@@ -116,7 +114,7 @@ BOOL session_claim(user_struct *vuser)
        sessionid.pid = pid;
        sessionid.uid = vuser->uid;
        sessionid.gid = vuser->gid;
-       fstrcpy(sessionid.remote_machine, remote_machine);
+       fstrcpy(sessionid.remote_machine, get_remote_machine_name());
        fstrcpy(sessionid.ip_addr, client_addr());
 
        if (!smb_pam_claim_session(sessionid.username, sessionid.id_str, sessionid.hostname)) {
index f6d536f30196bb9672500804e322b024cc3e2295..d45b04202e97f1a7e025281db2adf3768e792338 100644 (file)
@@ -607,7 +607,6 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,
        extern BOOL global_encrypted_passwords_negotiated;
        extern BOOL global_spnego_negotiated;
        extern int Protocol;
-       extern fstring remote_machine;
        extern userdom_struct current_user_info;
        extern int max_send;
 
@@ -736,7 +735,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,
                return ERROR_NT(NT_STATUS_LOGON_FAILURE);
        }
 
-       DEBUG(3,("sesssetupX:name=[%s]\\[%s]@[%s]\n", domain, user, remote_machine));
+       DEBUG(3,("sesssetupX:name=[%s]\\[%s]@[%s]\n", domain, user, get_remote_machine_name()));
 
        if (*user) {
                if (global_spnego_negotiated) {
index 740003035cf4768e4d91430e75690598dc46d236..14d3e730f475f0e9c25b26519dd99fe4da4fc65f 100644 (file)
@@ -26,7 +26,6 @@ extern pstring global_myname;
 
 extern pstring user_socket_options;
 
-extern fstring remote_machine;
 extern WINS_OWNER *global_wins_table;
 extern int partner_count;
 
@@ -637,7 +636,7 @@ static void process(void)
                lp_set_logfile(logfile);
        }
 
-       pstrcpy(remote_machine, "wrepld");
+       set_remote_machine_name("wrepld");
 
        setup_logging(argv[0],interactive);