From e63bcdd720d801df278ef84063c46144df087793 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 1 Nov 2007 18:13:00 +0100 Subject: Remove the silly "user_socket_options" global variable This is better done with a 'lp_do_parameter(-1, "socket options", ..); (This used to be commit 814bed029efa391e664ac432d0d68dfeab26381f) --- source3/client/smbmount.c | 3 +-- source3/lib/popt_common.c | 3 +-- source3/lib/util.c | 1 - source3/libsmb/cliconnect.c | 6 ++---- source3/param/loadparm.c | 6 +++--- source3/smbd/server.c | 14 ++++++++------ source3/torture/rpctorture.c | 5 +---- source3/torture/vfstest.c | 5 ++--- 8 files changed, 18 insertions(+), 25 deletions(-) diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c index 7befd6ef3c..5e69cf92a3 100644 --- a/source3/client/smbmount.c +++ b/source3/client/smbmount.c @@ -24,7 +24,6 @@ #include extern bool in_client; -extern pstring user_socket_options; extern char *optarg; extern int optind; @@ -807,7 +806,7 @@ static void parse_mount_smb(int argc, char **argv) } else if(!strcmp(opts, "workgroup")) { pstrcpy(workgroup,opteq+1); } else if(!strcmp(opts, "sockopt")) { - pstrcpy(user_socket_options,opteq+1); + lp_do_parameter(-1, "socket options", opteq+1); } else if(!strcmp(opts, "scope")) { set_global_scope(opteq+1); } else { diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c index ec05762cdf..7cc066d667 100644 --- a/source3/lib/popt_common.c +++ b/source3/lib/popt_common.c @@ -33,7 +33,6 @@ * -i,--scope */ -extern pstring user_socket_options; extern bool AllowDebugChange; extern bool override_logfile; @@ -92,7 +91,7 @@ static void popt_common_callback(poptContext con, case 'O': if (arg) { - pstrcpy(user_socket_options,arg); + lp_do_parameter(-1, "socket options", arg); } break; diff --git a/source3/lib/util.c b/source3/lib/util.c index fd79a7eb46..7f0ec0b132 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -68,7 +68,6 @@ int chain_size = 0; int trans_num = 0; static enum remote_arch_types ra_type = RA_UNKNOWN; -pstring user_socket_options=DEFAULT_SOCKET_OPTIONS; /*********************************************************************** Definitions for all names. diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 8b180f0135..2fdd1223f0 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -20,8 +20,6 @@ #include "includes.h" -extern pstring user_socket_options; - static const struct { int prot; const char *name; @@ -1382,7 +1380,7 @@ bool cli_session_request(struct cli_state *cli, DEBUG(3,("Retargeted\n")); - set_socket_options(cli->fd,user_socket_options); + set_socket_options(cli->fd, lp_socket_options()); /* Try again */ { @@ -1469,7 +1467,7 @@ NTSTATUS cli_connect(struct cli_state *cli, return map_nt_error_from_unix(errno); } - set_socket_options(cli->fd,user_socket_options); + set_socket_options(cli->fd, lp_socket_options()); return NT_STATUS_OK; } diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 07f8dc4144..94f1c0e5b6 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -55,7 +55,6 @@ bool in_client = False; /* Not in the client by default */ bool bLoaded = False; -extern pstring user_socket_options; extern enum protocol_types Protocol; extern userdom_struct current_user_info; @@ -1052,7 +1051,7 @@ static struct parm_struct parm_table[] = { {"max open files", P_INTEGER, P_GLOBAL, &Globals.max_open_files, NULL, NULL, FLAG_ADVANCED}, {"min print space", P_INTEGER, P_LOCAL, &sDefault.iMinPrintSpace, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT}, - {"socket options", P_GSTRING, P_GLOBAL, user_socket_options, NULL, NULL, FLAG_ADVANCED}, + {"socket options", P_STRING, P_GLOBAL, &Globals.szSocketOptions, NULL, NULL, FLAG_ADVANCED}, {"strict allocate", P_BOOL, P_LOCAL, &sDefault.bStrictAllocate, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE}, {"strict sync", P_BOOL, P_LOCAL, &sDefault.bStrictSync, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE}, {"sync always", P_BOOL, P_LOCAL, &sDefault.bSyncAlways, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE}, @@ -1505,7 +1504,7 @@ static void init_globals(bool first_time_only) string_set(&Globals.szPanicAction, "/bin/sleep 999999999"); #endif - pstrcpy(user_socket_options, DEFAULT_SOCKET_OPTIONS); + string_set(&Globals.szSocketOptions, DEFAULT_SOCKET_OPTIONS); string_set(&Globals.szLogonDrive, ""); /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */ @@ -2032,6 +2031,7 @@ FN_GLOBAL_INTEGER(lp_map_to_guest, &Globals.map_to_guest) FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, &Globals.oplock_break_wait_time) FN_GLOBAL_INTEGER(lp_lock_spin_time, &Globals.iLockSpinTime) FN_GLOBAL_INTEGER(lp_usershare_max_shares, &Globals.iUsershareMaxShares) +FN_GLOBAL_CONST_STRING(lp_socket_options, &Globals.szSocketOptions) FN_LOCAL_STRING(lp_preexec, szPreExec) FN_LOCAL_STRING(lp_postexec, szPostExec) diff --git a/source3/smbd/server.c b/source3/smbd/server.c index fbf886ee67..547e9c6e81 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -34,7 +34,6 @@ int last_message = -1; #define LAST_MESSAGE() smb_fn_name(last_message) extern struct auth_context *negprot_global_auth_context; -extern pstring user_socket_options; extern SIG_ATOMIC_T got_sig_term; extern SIG_ATOMIC_T reload_after_sighup; static SIG_ATOMIC_T got_sig_cld; @@ -186,7 +185,7 @@ static bool open_sockets_inetd(void) close_low_fds(False); /* Don't close stderr */ set_socket_options(smbd_server_fd(),"SO_KEEPALIVE"); - set_socket_options(smbd_server_fd(), user_socket_options); + set_socket_options(smbd_server_fd(), lp_socket_options()); return True; } @@ -380,7 +379,8 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ /* ready to listen */ set_socket_options(s,"SO_KEEPALIVE"); - set_socket_options(s,user_socket_options); + set_socket_options(smbd_server_fd(), + lp_socket_options()); /* Set server socket to * non-blocking for the accept. */ @@ -446,7 +446,8 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ /* ready to listen */ set_socket_options(s,"SO_KEEPALIVE"); - set_socket_options(s,user_socket_options); + set_socket_options(smbd_server_fd(), + lp_socket_options()); /* Set server socket to non-blocking * for the accept. */ @@ -623,7 +624,8 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ am_parent = 0; set_socket_options(smbd_server_fd(),"SO_KEEPALIVE"); - set_socket_options(smbd_server_fd(),user_socket_options); + set_socket_options(smbd_server_fd(), + lp_socket_options()); /* this is needed so that we get decent entries in smbstatus for port 445 connects */ @@ -758,7 +760,7 @@ bool reload_services(bool test) if (smbd_server_fd() != -1) { set_socket_options(smbd_server_fd(),"SO_KEEPALIVE"); - set_socket_options(smbd_server_fd(), user_socket_options); + set_socket_options(smbd_server_fd(), lp_socket_options()); } mangle_reset_cache(); diff --git a/source3/torture/rpctorture.c b/source3/torture/rpctorture.c index 64e7b580f3..a9748ba905 100644 --- a/source3/torture/rpctorture.c +++ b/source3/torture/rpctorture.c @@ -25,9 +25,6 @@ extern pstring global_myname; -extern pstring user_socket_options; - - extern file_info def_finfo; #define CNV_LANG(s) dos2unix_format(s,False) @@ -360,7 +357,7 @@ enum client_action case 'O': { - pstrcpy(user_socket_options,optarg); + lp_do_parameter(-1, "socket options", optarg); break; } diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c index 0633d0c2e7..daecf3c2d1 100644 --- a/source3/torture/vfstest.c +++ b/source3/torture/vfstest.c @@ -32,8 +32,6 @@ static struct cmd_list { struct cmd_set *cmd_set; } *cmd_list; -extern pstring user_socket_options; - int get_client_fd(void) { return -1; @@ -470,7 +468,8 @@ bool reload_services(bool test) { if (smbd_server_fd() != -1) { set_socket_options(smbd_server_fd(),"SO_KEEPALIVE"); - set_socket_options(smbd_server_fd(), user_socket_options); + set_socket_options(smbd_server_fd(), + lp_socket_options()); } } -- cgit