Remove the silly "user_socket_options" global variable
authorVolker Lendecke <vl@sernet.de>
Thu, 1 Nov 2007 17:13:00 +0000 (18:13 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 9 Nov 2007 14:11:54 +0000 (15:11 +0100)
This is better done with a 'lp_do_parameter(-1, "socket options", ..);

source/client/smbmount.c
source/lib/popt_common.c
source/lib/util.c
source/libsmb/cliconnect.c
source/param/loadparm.c
source/smbd/server.c
source/torture/rpctorture.c
source/torture/vfstest.c

index 7befd6ef3c6d6d4ce766eb947e12e82ee642c9df..5e69cf92a36a46853ce31414e02d45e949344681 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/smb_fs.h>
 
 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 {
index ec05762cdf0ffbb6e1c1acd113f51b9967ec3705..7cc066d667774000eafeefd4ff2ef61ca51fcb8e 100644 (file)
@@ -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;
 
index fd79a7eb46cd2f622a6f57fc932ca5585f211515..7f0ec0b13260808f52b81b12e5db793aa1588890 100644 (file)
@@ -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.
index 8b180f0135804bc71c34f33efd3c6f099d56e65d..2fdd1223f0e022b57820b77c4845ec21254cd705 100644 (file)
@@ -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;
 }
index 07f8dc4144bdfe49e9f4389415b42a1e8e267316..94f1c0e5b6c00623ce2c75e82d5af52ff96e8e9f 100644 (file)
@@ -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)
index fbf886ee678cdcd4a2e1355afae6314f9ee9d607..547e9c6e8162db5179e6ebab626de88bf6bc82b7 100644 (file)
@@ -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();
index 64e7b580f3cb19ab202b57d084eea04535a5e60d..a9748ba9059b9a5d737e8392aa9455df6bcef189 100644 (file)
@@ -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;  
                        }
 
index 0633d0c2e7c8e2efa3e9290905b26d1ffd98cdbb..daecf3c2d1dffa5ff75a58eae68d0e4ca1fd0762 100644 (file)
@@ -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());
                }
        }