The branch, v3-2-test has been updated
       via  e94edb6bdbc9379b48679d7c72618acfe862fe52 (commit)
       via  078e5e98b3589cec78893d44146a653dad9a7460 (commit)
       via  aaceab1153f6c2a2adde83681913c771a16ca81f (commit)
       via  5873e6a1f8242e07b1699366a536350a7199c28c (commit)
       via  4c2a3396bb687703f6b74655fda2014d1f75200b (commit)
       via  1fe4ea63b197cb7ebc054909d888d74b5ad6523c (commit)
      from  8d02a2de61eb6b62fef1fbe57194c9d286423ba0 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit e94edb6bdbc9379b48679d7c72618acfe862fe52
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Tue Dec 25 03:08:00 2007 +0100

    Add comment header to function libnet_smbconf_drop().
    
    Michael

commit 078e5e98b3589cec78893d44146a653dad9a7460
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Tue Dec 25 03:06:48 2007 +0100

    Remove a d_fprintf() from libnet_smbconf_drop().
    
    Michael

commit aaceab1153f6c2a2adde83681913c771a16ca81f
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Tue Dec 25 03:05:06 2007 +0100

    Remove talloc context parameter from libnet_smbconf_drop().
    
    Make use of talloc_stackframe.
    
    Michael

commit 5873e6a1f8242e07b1699366a536350a7199c28c
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Tue Dec 25 03:01:59 2007 +0100

    Rename drop_smbconf_internal() to libnet_smbconf_drop().
    
    Michael

commit 4c2a3396bb687703f6b74655fda2014d1f75200b
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Tue Dec 25 02:55:07 2007 +0100

    Move drop_smbconf_internal() to libnet_conf.c
    
    Michael

commit 1fe4ea63b197cb7ebc054909d888d74b5ad6523c
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Tue Dec 25 02:48:45 2007 +0100

    Use the proper boolean constants in net_conf.c
    
    Michael

-----------------------------------------------------------------------

Summary of changes:
 source/libnet/libnet_conf.c |   46 +++++++++++++++++++++++++++
 source/utils/net_conf.c     |   72 ++++++------------------------------------
 2 files changed, 57 insertions(+), 61 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/libnet/libnet_conf.c b/source/libnet/libnet_conf.c
index 4c5a082..c9b4f20 100644
--- a/source/libnet/libnet_conf.c
+++ b/source/libnet/libnet_conf.c
@@ -244,6 +244,52 @@ done:
  **********************************************************************/
 
 /**
+ * Drop the whole configuration (restarting empty).
+ */
+WERROR libnet_smbconf_drop(void)
+{
+       char *path, *p;
+       WERROR werr = WERR_OK;
+       NT_USER_TOKEN *token;
+       struct registry_key *parent_key = NULL;
+       struct registry_key *new_key = NULL;
+       TALLOC_CTX* mem_ctx = talloc_stackframe();
+       enum winreg_CreateAction action;
+
+       if (!(token = registry_create_admin_token(mem_ctx))) {
+               /* what is the appropriate error code here? */
+               werr = WERR_CAN_NOT_COMPLETE;
+               goto done;
+       }
+
+       path = talloc_strdup(mem_ctx, KEY_SMBCONF);
+       if (path == NULL) {
+               werr = WERR_NOMEM;
+               goto done;
+       }
+       p = strrchr(path, '\\');
+       *p = '\0';
+       werr = reg_open_path(mem_ctx, path, REG_KEY_WRITE, token, &parent_key);
+
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       werr = reg_deletekey_recursive(mem_ctx, parent_key, p+1);
+
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       werr = reg_createkey(mem_ctx, parent_key, p+1, REG_KEY_WRITE,
+                            &new_key, &action);
+
+done:
+       TALLOC_FREE(mem_ctx);
+       return werr;
+}
+
+/**
  * delete a service from configuration
  */
 WERROR libnet_smbconf_delshare(const char *servicename)
diff --git a/source/utils/net_conf.c b/source/utils/net_conf.c
index 54875c4..9a6f540 100644
--- a/source/utils/net_conf.c
+++ b/source/utils/net_conf.c
@@ -168,56 +168,6 @@ done:
        return werr;
 }
 
-static WERROR drop_smbconf_internal(TALLOC_CTX *ctx)
-{
-       char *path, *p;
-       WERROR werr = WERR_OK;
-       NT_USER_TOKEN *token;
-       struct registry_key *parent_key = NULL;
-       struct registry_key *new_key = NULL;
-       TALLOC_CTX* tmp_ctx = NULL;
-       enum winreg_CreateAction action;
-
-       tmp_ctx = talloc_new(ctx);
-       if (tmp_ctx == NULL) {
-               werr = WERR_NOMEM;
-               goto done;
-       }
-
-       if (!(token = registry_create_admin_token(tmp_ctx))) {
-               /* what is the appropriate error code here? */
-               werr = WERR_CAN_NOT_COMPLETE;
-               goto done;
-       }
-
-       path = talloc_strdup(tmp_ctx, KEY_SMBCONF);
-       if (path == NULL) {
-               d_fprintf(stderr, "ERROR: out of memory!\n");
-               werr = WERR_NOMEM;
-               goto done;
-       }
-       p = strrchr(path, '\\');
-       *p = '\0';
-       werr = reg_open_path(tmp_ctx, path, REG_KEY_WRITE, token, &parent_key);
-
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = reg_deletekey_recursive(tmp_ctx, parent_key, p+1);
-
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = reg_createkey(tmp_ctx, parent_key, p+1, REG_KEY_WRITE,
-                            &new_key, &action);
-
-done:
-       TALLOC_FREE(tmp_ctx);
-       return werr;
-}
-
 static char *parm_valstr(TALLOC_CTX *ctx, struct parm_struct *parm,
                         struct share_params *share)
 {
@@ -360,7 +310,7 @@ done:
        return ret;
 }
 
-/* return True iff there are nondefault globals */
+/* return true iff there are nondefault globals */
 static bool globals_exist(void)
 {
        int i = 0;
@@ -368,10 +318,10 @@ static bool globals_exist(void)
 
        while ((parm = lp_next_parameter(GLOBAL_SECTION_SNUM, &i, 0)) != NULL) {
                if (parm->type != P_SEP) {
-                       return True;
+                       return true;
                }
        }
-       return False;
+       return false;
 }
 
 /*
@@ -456,7 +406,7 @@ int net_conf_import(int argc, const char **argv)
        int ret = -1;
        const char *filename = NULL;
        const char *servicename = NULL;
-       bool service_found = False;
+       bool service_found = false;
        TALLOC_CTX *ctx;
        struct share_iterator *shares;
        struct share_params *share;
@@ -480,10 +430,10 @@ int net_conf_import(int argc, const char **argv)
                filename));
 
        if (!lp_load(filename,
-                    False,     /* global_only */
-                    True,      /* save_defaults */
-                    False,     /* add_ipc */
-                    True))     /* initialize_globals */
+                    false,     /* global_only */
+                    true,      /* save_defaults */
+                    false,     /* add_ipc */
+                    true))     /* initialize_globals */
        {
                d_fprintf(stderr, "Error parsing configuration file.\n");
                goto done;
@@ -497,7 +447,7 @@ int net_conf_import(int argc, const char **argv)
        if (((servicename == NULL) && globals_exist()) ||
            strequal(servicename, GLOBAL_NAME))
        {
-               service_found = True;
+               service_found = true;
                if (import_process_service(ctx, &global_share) != 0) {
                        goto done;
                }
@@ -516,7 +466,7 @@ int net_conf_import(int argc, const char **argv)
                if ((servicename == NULL)
                    || strequal(servicename, lp_servicename(share->service)))
                {
-                       service_found = True;
+                       service_found = true;
                        if (import_process_service(ctx, share)!= 0) {
                                goto done;
                        }
@@ -588,7 +538,7 @@ int net_conf_drop(int argc, const char **argv)
                goto done;
        }
 
-       werr = drop_smbconf_internal(NULL);
+       werr = libnet_smbconf_drop();
        if (!W_ERROR_IS_OK(werr)) {
                d_fprintf(stderr, "Error deleting configuration: %s\n",
                          dos_errstr(werr));


-- 
Samba Shared Repository

Reply via email to