Pass sharename to delete_share_security()
authorvlendec <vlendec@0c0555d6-39d7-0310-84fc-f1cc0bd64818>
Sun, 7 Oct 2007 17:58:48 +0000 (17:58 +0000)
committervlendec <vlendec@0c0555d6-39d7-0310-84fc-f1cc0bd64818>
Sun, 7 Oct 2007 17:58:48 +0000 (17:58 +0000)
git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/SAMBA_3_2@25564 0c0555d6-39d7-0310-84fc-f1cc0bd64818

source/lib/sharesec.c
source/param/loadparm.c
source/rpc_server/srv_srvsvc_nt.c

index 258b121..58e28e7 100644 (file)
@@ -197,18 +197,20 @@ BOOL set_share_security(const char *share_name, SEC_DESC *psd)
  Delete a security descriptor.
 ********************************************************************/
 
-BOOL delete_share_security(const struct share_params *params)
+BOOL delete_share_security(const char *servicename)
 {
        TDB_DATA kbuf;
-       fstring key;
+       char *key;
 
-       slprintf(key, sizeof(key)-1, "SECDESC/%s",
-                lp_servicename(params->service));
+       if (!(key = talloc_asprintf(talloc_tos(), "SECDESC/%s",
+                                   servicename))) {
+               return False;
+       }
        kbuf = string_term_tdb_data(key);
 
        if (tdb_trans_delete(share_tdb, kbuf) != 0) {
-               DEBUG(0,("delete_share_security: Failed to delete entry for share %s\n",
-                        lp_servicename(params->service) ));
+               DEBUG(0, ("delete_share_security: Failed to delete entry for "
+                         "share %s\n", servicename));
                return False;
        }
 
index d7e1522..84e3658 100644 (file)
@@ -5517,7 +5517,7 @@ int load_usershare_shares(void)
                        /* Remove from the share ACL db. */
                        DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
                                lp_servicename(iService) ));
-                       delete_share_security(snum2params_static(iService));
+                       delete_share_security(lp_servicename(iService));
                        free_service_byindex(iService);
                }
        }
@@ -5749,7 +5749,7 @@ int lp_servicenumber(const char *pszServiceName)
 
                if (!usershare_exists(iService, &last_mod)) {
                        /* Remove the share security tdb entry for it. */
-                       delete_share_security(snum2params_static(iService));
+                       delete_share_security(lp_servicename(iService));
                        /* Remove it from the array. */
                        free_service_byindex(iService);
                        /* Doesn't exist anymore. */
index 321ff83..2af4c79 100644 (file)
@@ -1994,7 +1994,7 @@ WERROR _srvsvc_NetShareDel(pipes_struct *p, struct srvsvc_NetShareDel *r)
        }
 
        /* Delete the SD in the database. */
-       delete_share_security(params);
+       delete_share_security(lp_servicename(params->service));
 
        lp_killservice(params->service);