Author: jerry
Date: 2006-01-23 14:34:26 +0000 (Mon, 23 Jan 2006)
New Revision: 13085

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13085

Log:
hook the max connections spin box in the share properties MMC plugin
dialog to the 'max connections' smb.conf parameter.  Also added the max
uses int from the SHARE_INFO_2 structure to the 'modify share command'


Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_srvsvc_nt.c
   trunk/source/rpc_server/srv_srvsvc_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_srvsvc_nt.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_server/srv_srvsvc_nt.c        2006-01-23 
14:29:10 UTC (rev 13084)
+++ branches/SAMBA_3_0/source/rpc_server/srv_srvsvc_nt.c        2006-01-23 
14:34:26 UTC (rev 13085)
@@ -2,8 +2,8 @@
  *  Unix SMB/CIFS implementation.
  *  RPC Pipe client / server routines
  *  Copyright (C) Andrew Tridgell              1992-1997,
- *  Copyright (C) Jeremy Allison                                       2001.
- *  Copyright (C) Nigel Williams                                       2001.
+ *  Copyright (C) Jeremy Allison               2001.
+ *  Copyright (C) Nigel Williams               2001.
  *  
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -109,6 +109,8 @@
        pstring remark;
        pstring path;
        pstring passwd;
+       int max_connections = lp_max_connections(snum);
+       uint32 max_uses = max_connections!=0 ? max_connections : 0xffffffff;
 
        char *net_name = lp_servicename(snum);
        pstrcpy(remark, lp_comment(snum));
@@ -125,7 +127,7 @@
 
        pstrcpy(passwd, "");
 
-       init_srv_share_info2(&sh2->info_2, net_name, get_share_type(snum), 
remark, 0, 0xffffffff, 1, path, passwd);
+       init_srv_share_info2(&sh2->info_2, net_name, get_share_type(snum), 
remark, 0, max_uses, 1, path, passwd);
        init_srv_share_info2_str(&sh2->info_2_str, net_name, remark, path, 
passwd);
 }
 
@@ -1539,6 +1541,7 @@
        SEC_DESC *psd = NULL;
        SE_PRIV se_diskop = SE_DISK_OPERATOR;
        BOOL is_disk_op = False;
+       int max_connections = 0;
 
        DEBUG(5,("_srv_net_share_set_info: %d\n", __LINE__));
 
@@ -1583,6 +1586,7 @@
                unistr2_to_ascii(comment, 
&q_u->info.share.info2.info_2_str.uni_remark, sizeof(comment));
                unistr2_to_ascii(pathname, 
&q_u->info.share.info2.info_2_str.uni_path, sizeof(pathname));
                type = q_u->info.share.info2.info_2.type;
+               max_connections = (q_u->info.share.info2.info_2.max_uses == 
0xffffffff) ? 0 : q_u->info.share.info2.info_2.max_uses;
                psd = NULL;
                break;
 #if 0
@@ -1651,15 +1655,16 @@
 
        /* Only call modify function if something changed. */
        
-       if (strcmp(path, lp_pathname(snum)) || strcmp(comment, 
lp_comment(snum)) ) 
+       if (strcmp(path, lp_pathname(snum)) || strcmp(comment, 
lp_comment(snum)) 
+               || (lp_max_connections(snum) != max_connections) ) 
        {
                if (!lp_change_share_cmd() || !*lp_change_share_cmd()) {
                        DEBUG(10,("_srv_net_share_set_info: No change share 
command\n"));
                        return WERR_ACCESS_DENIED;
                }
 
-               slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" 
\"%s\"",
-                               lp_change_share_cmd(), dyn_CONFIGFILE, 
share_name, path, comment);
+               slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" 
\"%s\" %d",
+                               lp_change_share_cmd(), dyn_CONFIGFILE, 
share_name, path, comment, max_connections ); 
 
                DEBUG(10,("_srv_net_share_set_info: Running [%s]\n", command ));
                                
@@ -1951,16 +1956,17 @@
        TIME_OF_DAY_INFO *tod;
        struct tm *t;
        time_t unixdate = time(NULL);
+
        /* We do this call first as if we do it *after* the gmtime call
           it overwrites the pointed-to values. JRA */
+
        uint32 zone = get_time_zone(unixdate)/60;
 
-       tod = TALLOC_P(p->mem_ctx, TIME_OF_DAY_INFO);
-       if (!tod)
+       DEBUG(5,("_srv_net_remote_tod: %d\n", __LINE__));
+
+       if ( !(tod = TALLOC_ZERO_P(p->mem_ctx, TIME_OF_DAY_INFO)) )
                return WERR_NOMEM;
 
-       ZERO_STRUCTP(tod);
- 
        r_u->tod = tod;
        r_u->ptr_srv_tod = 0x1;
        r_u->status = WERR_OK;

Modified: trunk/source/rpc_server/srv_srvsvc_nt.c
===================================================================
--- trunk/source/rpc_server/srv_srvsvc_nt.c     2006-01-23 14:29:10 UTC (rev 
13084)
+++ trunk/source/rpc_server/srv_srvsvc_nt.c     2006-01-23 14:34:26 UTC (rev 
13085)
@@ -2,8 +2,8 @@
  *  Unix SMB/CIFS implementation.
  *  RPC Pipe client / server routines
  *  Copyright (C) Andrew Tridgell              1992-1997,
- *  Copyright (C) Jeremy Allison                                       2001.
- *  Copyright (C) Nigel Williams                                       2001.
+ *  Copyright (C) Jeremy Allison               2001.
+ *  Copyright (C) Nigel Williams               2001.
  *  
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -89,6 +89,8 @@
        pstring remark;
        pstring path;
        pstring passwd;
+       int max_connections = lp_max_connections(snum);
+       uint32 max_uses = max_connections!=0 ? max_connections : 0xffffffff;
 
        char *net_name = lp_servicename(snum);
        pstrcpy(remark, lp_comment(snum));
@@ -105,7 +107,7 @@
 
        pstrcpy(passwd, "");
 
-       init_srv_share_info2(&sh2->info_2, net_name, get_share_type(snum), 
remark, 0, 0xffffffff, 1, path, passwd);
+       init_srv_share_info2(&sh2->info_2, net_name, get_share_type(snum), 
remark, 0, max_uses, 1, path, passwd);
        init_srv_share_info2_str(&sh2->info_2_str, net_name, remark, path, 
passwd);
 }
 
@@ -1345,6 +1347,7 @@
        SEC_DESC *psd = NULL;
        SE_PRIV se_diskop = SE_DISK_OPERATOR;
        BOOL is_disk_op = False;
+       int max_connections = 0;
 
        DEBUG(5,("_srv_net_share_set_info: %d\n", __LINE__));
 
@@ -1389,6 +1392,7 @@
                unistr2_to_ascii(comment, 
&q_u->info.share.info2.info_2_str.uni_remark, sizeof(comment));
                unistr2_to_ascii(pathname, 
&q_u->info.share.info2.info_2_str.uni_path, sizeof(pathname));
                type = q_u->info.share.info2.info_2.type;
+               max_connections = (q_u->info.share.info2.info_2.max_uses == 
0xffffffff) ? 0 : q_u->info.share.info2.info_2.max_uses;
                psd = NULL;
                break;
 #if 0
@@ -1457,15 +1461,16 @@
 
        /* Only call modify function if something changed. */
        
-       if (strcmp(path, lp_pathname(snum)) || strcmp(comment, 
lp_comment(snum)) ) 
+       if (strcmp(path, lp_pathname(snum)) || strcmp(comment, 
lp_comment(snum)) 
+               || (lp_max_connections(snum) != max_connections) ) 
        {
                if (!lp_change_share_cmd() || !*lp_change_share_cmd()) {
                        DEBUG(10,("_srv_net_share_set_info: No change share 
command\n"));
                        return WERR_ACCESS_DENIED;
                }
 
-               slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" 
\"%s\"",
-                               lp_change_share_cmd(), dyn_CONFIGFILE, 
share_name, path, comment);
+               slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" 
\"%s\" %d",
+                               lp_change_share_cmd(), dyn_CONFIGFILE, 
share_name, path, comment, max_connections ); 
 
                DEBUG(10,("_srv_net_share_set_info: Running [%s]\n", command ));
                                
@@ -1757,16 +1762,17 @@
        TIME_OF_DAY_INFO *tod;
        struct tm *t;
        time_t unixdate = time(NULL);
+
        /* We do this call first as if we do it *after* the gmtime call
           it overwrites the pointed-to values. JRA */
+
        uint32 zone = get_time_zone(unixdate)/60;
 
-       tod = TALLOC_P(p->mem_ctx, TIME_OF_DAY_INFO);
-       if (!tod)
+       DEBUG(5,("_srv_net_remote_tod: %d\n", __LINE__));
+
+       if ( !(tod = TALLOC_ZERO_P(p->mem_ctx, TIME_OF_DAY_INFO)) )
                return WERR_NOMEM;
 
-       ZERO_STRUCTP(tod);
- 
        r_u->tod = tod;
        r_u->ptr_srv_tod = 0x1;
        r_u->status = WERR_OK;

Reply via email to