From dd5615c04241ec09e6b877a0670a957fa7702902 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 11 Aug 2002 02:30:35 +0000 Subject: Make 'remote_machine' private to lib/substitute.c, and fix all the user to use the new accessor functions. Andrew Bartlett (This used to be commit f393de2310e997d05674eb7f1268655373e03647) --- source3/auth/auth_util.c | 5 ++--- source3/lib/substitute.c | 4 +++- source3/nmbd/nmbd.c | 3 +-- source3/smbd/connection.c | 3 +-- source3/smbd/filename.c | 1 - source3/smbd/negprot.c | 1 - source3/smbd/password.c | 2 +- source3/smbd/reply.c | 3 +-- source3/smbd/service.c | 10 ++++------ source3/smbd/session.c | 4 +--- source3/smbd/sesssetup.c | 3 +-- source3/wrepld/server.c | 3 +-- 12 files changed, 16 insertions(+), 26 deletions(-) (limited to 'source3') diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 3ade220c0f..f914d91871 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -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, diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index c47b5914f1..026df0f67f 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -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; diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 3a0dabe8d7..05ea4997d5 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -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; diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index b53ef9fb3f..5609c2963d 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -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; diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index e5f9b7a0ae..ce98af4ace 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -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); diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c index 1d79cbd5d0..2be04fd686 100644 --- a/source3/smbd/negprot.c +++ b/source3/smbd/negprot.c @@ -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; diff --git a/source3/smbd/password.c b/source3/smbd/password.c index 2558ffe163..6d922139e7 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -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); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index a4ed770f31..dc49fe3e2e 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -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); diff --git a/source3/smbd/service.c b/source3/smbd/service.c index aac90f2fdc..26e00aa49f 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -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) { diff --git a/source3/smbd/session.c b/source3/smbd/session.c index f7ade5570c..54b7a24b07 100644 --- a/source3/smbd/session.c +++ b/source3/smbd/session.c @@ -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)) { diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index f6d536f301..d45b04202e 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -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) { diff --git a/source3/wrepld/server.c b/source3/wrepld/server.c index 740003035c..14d3e730f4 100644 --- a/source3/wrepld/server.c +++ b/source3/wrepld/server.c @@ -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); -- cgit