libsmbconf: parse an empty share as empty share, not as NULL.
authorMichael Adam <obnox@samba.org>
Mon, 27 Sep 2010 10:43:39 +0000 (12:43 +0200)
committerMichael Adam <obnox@samba.org>
Thu, 30 Sep 2010 10:30:45 +0000 (12:30 +0200)
This fixes a segfault in net conf import:
Importing a text file with an empty share resulted in a segfault.
Now this creates an empty share in registry config, just as it
should.

Thanks to Gregor Beck <gbeck@sernet.de> for reporting.
(cherry picked from commit 84127dd50420a7d0e8f389d4af15d52fca6cd809)

lib/smbconf/smbconf_txt.c

index 501382cc5fd0416ab50fe61f69ffe7bc9ba69092..fc6fccaf98acf55bee732c37959c27ae5a08c286 100644 (file)
@@ -452,11 +452,7 @@ static WERROR smbconf_txt_get_share(struct smbconf_ctx *ctx,
        }
 
        tmp_service->num_params = count;
-       if (count > 0) {
-               *service = talloc_move(mem_ctx, &tmp_service);
-       } else {
-               *service = NULL;
-       }
+       *service = talloc_move(mem_ctx, &tmp_service);
 
 done:
        talloc_free(tmp_ctx);