The branch, master has been updated
       via  3ec0645 vfs_catia: Simplify init_mappings()
       via  f2f9acc smbd: Simplify ReadDirName
       via  4cdbf81 smbd: ZERO_STRUCT -> struct init
       via  6ed53d4 smbd: ZERO_STRUCT -> struct assignment
       via  09c0092 smbd: ZERO_STRUCT -> struct assignment
       via  9e810b2 smbd: ZERO_STRUCTP -> talloc_zero()
       via  9455344 param: Remove lib/param/generic.c
       via  e4bded6 libsmb: Use tevent_req_poll_ntstatus
      from  1237b00 lib: Simplify pidfile.c

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3ec06454e106e83ae7e72412202b3efcd4e6285b
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Feb 24 14:03:11 2015 +0000

    vfs_catia: Simplify init_mappings()
    
    No else required after return
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Thu Feb 26 21:22:30 CET 2015 on sn-devel-104

commit f2f9acc113e7c1dd9bca0c4cba8e503d18286d13
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Feb 24 13:46:09 2015 +0000

    smbd: Simplify ReadDirName
    
    In the if-branches we return, so no "else" necessary
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 4cdbf81243c03834fc534ce264c18d743c22f727
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Feb 23 11:17:59 2015 +0000

    smbd: ZERO_STRUCT -> struct init
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 6ed53d4967465f57cafa0b465744b30eec40a34e
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Feb 23 11:08:30 2015 +0000

    smbd: ZERO_STRUCT -> struct assignment
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 09c00923bafe1eb78ec45f33a5c3076dff44787a
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Feb 23 11:07:32 2015 +0000

    smbd: ZERO_STRUCT -> struct assignment
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 9e810b2fbe27b26c1ae5859b08d3159882c0f5bb
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Feb 23 11:04:58 2015 +0000

    smbd: ZERO_STRUCTP -> talloc_zero()
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 9455344e6689533097cd7c689d84aa90a937c1e9
Author: Volker Lendecke <v...@samba.org>
Date:   Fri Jan 2 11:46:28 2015 +0100

    param: Remove lib/param/generic.c
    
    This seems completely unused.
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit e4bded6551864979804d8c1e14196fe8e12cee2e
Author: Volker Lendecke <v...@samba.org>
Date:   Wed Feb 25 20:42:33 2015 +0000

    libsmb: Use tevent_req_poll_ntstatus
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

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

Summary of changes:
 lib/param/generic.c         | 276 --------------------------------------------
 lib/param/param.h           |  21 ----
 lib/param/wscript_build     |   2 +-
 libcli/smb/smb1cli_trans.c  |   3 +-
 libcli/smb/smbXcli_base.c   |   6 +-
 source3/modules/vfs_catia.c |   3 +-
 source3/smbd/dir.c          |  23 ++--
 source3/smbd/trans2.c       |  10 +-
 8 files changed, 21 insertions(+), 323 deletions(-)
 delete mode 100644 lib/param/generic.c


Changeset truncated at 500 lines:

diff --git a/lib/param/generic.c b/lib/param/generic.c
deleted file mode 100644
index 8becffb..0000000
--- a/lib/param/generic.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/* 
- *  Unix SMB/CIFS implementation.
- *  Copyright (C) Jelmer Vernooij                      2005
- *  
- *  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
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *  
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "includes.h"
-#include "../lib/util/dlinklist.h"
-#include "../lib/util/parmlist.h"
-#include "param/param.h"
-#include "param/loadparm.h"
-#include "system/filesys.h"
-
-struct param_section *param_get_section(struct param_context *ctx, const char 
*name)
-{
-       struct param_section *sect;
-
-       if (name == NULL) 
-               name = GLOBAL_NAME;
-
-       for (sect = ctx->sections; sect; sect = sect->next) {
-               if (!strcasecmp_m(sect->name, name)) 
-                       return sect;
-       }
-
-       return NULL;
-}
-
-struct parmlist_entry *param_section_get(struct param_section *section, const 
char *name)
-{
-       return parmlist_get(section->parameters, name);
-}
-
-struct param_section *param_add_section(struct param_context *ctx, const char 
*section_name)
-{
-       struct param_section *section;
-       section = talloc_zero(ctx, struct param_section);
-       if (section == NULL)
-               return NULL;
-
-       section->name = talloc_strdup(section, section_name);
-       DLIST_ADD_END(ctx->sections, section, struct param_section *);
-       return section;
-}
-
-/* Look up parameter. If it is not found, add it */
-struct parmlist_entry *param_get_add(struct param_context *ctx, const char 
*name, const char *section_name)
-{
-       struct param_section *section;
-       struct parmlist_entry *p;
-
-       SMB_ASSERT(section_name != NULL);
-       SMB_ASSERT(name != NULL);
-
-       section = param_get_section(ctx, section_name);
-
-       if (section == NULL) {
-               section = param_add_section(ctx, section_name);
-       }
-
-       p = param_section_get(section, name);
-       if (p == NULL) {
-               p = talloc_zero(section, struct parmlist_entry);
-               if (p == NULL)
-                       return NULL;
-
-               p->key = talloc_strdup(p, name);
-               DLIST_ADD_END(section->parameters->entries, p, struct 
parmlist_entry *);
-       }
-       
-       return p;
-}
-
-const char *param_get_string(struct param_context *ctx, const char *param, 
const char *section_name)
-{
-       struct param_section *section = param_get_section(ctx, section_name);
-
-       if (section == NULL)
-               return NULL;
-
-       return parmlist_get_string(section->parameters, param, NULL);
-}
-
-int param_set_string(struct param_context *ctx, const char *param, const char 
*value, const char *section_name)
-{
-       struct param_section *section = param_get_section(ctx, section_name);
-
-       if (section == NULL)
-               return -1;
-
-       return parmlist_set_string(section->parameters, param, value);
-}
-
-const char **param_get_string_list(struct param_context *ctx, const char 
*param, const char *separator, const char *section_name)
-{
-       struct param_section *section = param_get_section(ctx, section_name);
-
-       if (section == NULL)
-               return NULL;
-
-       return parmlist_get_string_list(section->parameters, param, separator);
-}
-
-int param_set_string_list(struct param_context *ctx, const char *param, const 
char **list, const char *section)
-{
-       struct parmlist_entry *p = param_get_add(ctx, param, section);  
-
-       p->value = str_list_join(p, list, ' ');
-
-       return 0;
-}
-
-int param_get_int(struct param_context *ctx, const char *param, int default_v, 
const char *section_name)
-{
-       struct param_section *section = param_get_section(ctx, section_name);
-
-       if (section == NULL)
-               return default_v;
-
-       return parmlist_get_int(section->parameters, param, default_v);
-}
-
-void param_set_int(struct param_context *ctx, const char *param, int value, 
const char *section)
-{
-       struct parmlist_entry *p = param_get_add(ctx, section, param);
-
-       if (!p) 
-               return;
-
-       p->value = talloc_asprintf(p, "%d", value);
-}
-
-unsigned long param_get_ulong(struct param_context *ctx, const char *param, 
unsigned long default_v, const char *section)
-{
-       const char *value = param_get_string(ctx, param, section);
-       
-       if (value)
-               return strtoul(value, NULL, 0);
-
-       return default_v;
-}
-
-void param_set_ulong(struct param_context *ctx, const char *name, unsigned 
long value, const char *section)
-{
-       struct parmlist_entry *p = param_get_add(ctx, name, section);
-
-       if (!p)
-               return;
-
-       p->value = talloc_asprintf(p, "%lu", value);
-}
-
-static bool param_sfunc (const char *name, void *_ctx)
-{
-       struct param_context *ctx = (struct param_context *)_ctx;
-       struct param_section *section = param_get_section(ctx, name);
-
-       if (section == NULL) {
-               section = talloc_zero(ctx, struct param_section);
-               if (section == NULL)
-                       return false;
-
-               section->name = talloc_strdup(section, name);
-
-               DLIST_ADD_END(ctx->sections, section, struct param_section *);
-       }
-
-       /* Make sure this section is on top of the list for param_pfunc */
-       DLIST_PROMOTE(ctx->sections, section);
-
-       return true;
-}
-
-static bool param_pfunc (const char *name, const char *value, void *_ctx)
-{
-       struct param_context *ctx = (struct param_context *)_ctx;
-       struct parmlist_entry *p = param_section_get(ctx->sections, name);
-
-       if (!p) {
-               p = talloc_zero(ctx->sections, struct parmlist_entry);
-               if (p == NULL)
-                       return false;
-
-               p->key = talloc_strdup(p, name);
-               p->value = talloc_strdup(p, value);
-               DLIST_ADD(ctx->sections->parameters->entries, p);
-       } else { /* Replace current value */
-               talloc_free(p->value);
-               p->value = talloc_strdup(p, value);
-       }
-
-       return true;
-}
-
-struct param_context *param_init(TALLOC_CTX *mem_ctx)
-{
-       return talloc_zero(mem_ctx, struct param_context);
-}
-
-
-int param_read(struct param_context *ctx, const char *fn)
-{
-       ctx->sections = talloc_zero(ctx, struct param_section);
-       if (ctx->sections == NULL)
-               return -1;
-
-       ctx->sections->name = talloc_strdup(ctx->sections, "global");
-       if (!pm_process( fn, param_sfunc, param_pfunc, ctx)) {
-               return -1;
-       }
-
-       return 0;
-}
-
-int param_use(struct loadparm_context *lp_ctx, struct param_context *ctx)
-{
-       struct param_section *section;
-
-       for (section = ctx->sections; section; section = section->next) {
-               struct parmlist_entry *param;
-               bool isglobal = strcmp(section->name, "global") == 0;
-               for (param = section->parameters->entries; param; param = 
param->next) {
-                       if (isglobal)
-                               lpcfg_do_global_parameter(lp_ctx, param->key,
-                                                      param->value);
-                       else {
-                               struct loadparm_service *service = 
-                                                       lpcfg_service(lp_ctx, 
section->name);
-                               if (service == NULL)
-                                       service = lpcfg_add_service(lp_ctx, 
lpcfg_default_service(lp_ctx), section->name);
-                               lpcfg_do_service_parameter(lp_ctx, service, 
param->key, param->value);
-                       }
-               }
-       }
-       return 0;
-}
-
-int param_write(struct param_context *ctx, const char *fn)
-{
-       int file;
-       struct param_section *section;
-
-       if (fn == NULL || ctx == NULL)
-               return -1;
-
-       file = open(fn, O_WRONLY|O_CREAT, 0755);
-
-       if (file == -1)
-               return -1;
-       
-       for (section = ctx->sections; section; section = section->next) {
-               struct parmlist_entry *param;
-               
-               fdprintf(file, "[%s]\n", section->name);
-               for (param = section->parameters->entries; param; param = 
param->next) {
-                       fdprintf(file, "\t%s = %s\n", param->key, param->value);
-               }
-               fdprintf(file, "\n");
-       }
-
-       close(file);
-
-       return 0;
-}
diff --git a/lib/param/param.h b/lib/param/param.h
index 2fb6d4b..5e8d2bd 100644
--- a/lib/param/param.h
+++ b/lib/param/param.h
@@ -213,27 +213,6 @@ struct dcerpc_server_info 
*lpcfg_dcerpc_server_info(TALLOC_CTX *mem_ctx, struct
 struct gensec_settings *lpcfg_gensec_settings(TALLOC_CTX *, struct 
loadparm_context *);
 
 
-/* The following definitions come from param/generic.c  */
-
-struct param_section *param_get_section(struct param_context *ctx, const char 
*name);
-struct parmlist_entry *param_section_get(struct param_section *section, 
-                                   const char *name);
-struct parmlist_entry *param_get (struct param_context *ctx, const char *name, 
const char *section_name);
-struct param_section *param_add_section(struct param_context *ctx, const char 
*section_name);
-struct parmlist_entry *param_get_add(struct param_context *ctx, const char 
*name, const char *section_name);
-const char *param_get_string(struct param_context *ctx, const char *param, 
const char *section);
-int param_set_string(struct param_context *ctx, const char *param, const char 
*value, const char *section);
-const char **param_get_string_list(struct param_context *ctx, const char 
*param, const char *separator, const char *section);
-int param_set_string_list(struct param_context *ctx, const char *param, const 
char **list, const char *section);
-int param_get_int(struct param_context *ctx, const char *param, int default_v, 
const char *section);
-void param_set_int(struct param_context *ctx, const char *param, int value, 
const char *section);
-unsigned long param_get_ulong(struct param_context *ctx, const char *param, 
unsigned long default_v, const char *section);
-void param_set_ulong(struct param_context *ctx, const char *name, unsigned 
long value, const char *section);
-struct param_context *param_init(TALLOC_CTX *mem_ctx);
-int param_read(struct param_context *ctx, const char *fn);
-int param_use(struct loadparm_context *lp_ctx, struct param_context *ctx);
-int param_write(struct param_context *ctx, const char *fn);
-
 /* The following definitions come from param/util.c  */
 
 
diff --git a/lib/param/wscript_build b/lib/param/wscript_build
index 69746bc..66003e9 100644
--- a/lib/param/wscript_build
+++ b/lib/param/wscript_build
@@ -30,7 +30,7 @@ bld.SAMBA_LIBRARY('server-role',
                   private_library=True)
 
 bld.SAMBA_LIBRARY('samba-hostconfig',
-       source='loadparm.c generic.c util.c param_table.c',
+       source='loadparm.c util.c param_table.c',
        pc_files='samba-hostconfig.pc',
        vnum='0.0.1',
        deps='DYNCONFIG server-role tdb',
diff --git a/libcli/smb/smb1cli_trans.c b/libcli/smb/smb1cli_trans.c
index 38d4e2e..59888ba 100644
--- a/libcli/smb/smb1cli_trans.c
+++ b/libcli/smb/smb1cli_trans.c
@@ -894,8 +894,7 @@ NTSTATUS smb1cli_trans(TALLOC_CTX *mem_ctx, struct 
smbXcli_conn *conn,
                goto fail;
        }
 
-       if (!tevent_req_poll(req, ev)) {
-               status = map_nt_error_from_unix_common(errno);
+       if (!tevent_req_poll_ntstatus(req, ev, &status)) {
                goto fail;
        }
 
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 2b34980..5773ab3 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -590,9 +590,8 @@ NTSTATUS smbXcli_conn_samba_suicide(struct smbXcli_conn 
*conn,
        if (req == NULL) {
                goto fail;
        }
-       ok = tevent_req_poll(req, ev);
+       ok = tevent_req_poll_ntstatus(req, ev, &status);
        if (!ok) {
-               status = map_nt_error_from_unix_common(errno);
                goto fail;
        }
        status = smbXcli_conn_samba_suicide_recv(req);
@@ -4876,9 +4875,8 @@ NTSTATUS smbXcli_negprot(struct smbXcli_conn *conn,
        if (req == NULL) {
                goto fail;
        }
-       ok = tevent_req_poll(req, ev);
+       ok = tevent_req_poll_ntstatus(req, ev, &status);
        if (!ok) {
-               status = map_nt_error_from_unix_common(errno);
                goto fail;
        }
        status = smbXcli_negprot_recv(req);
diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index 6743dfe..35cae1e 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -210,7 +210,8 @@ static bool init_mappings(connection_struct *conn,
        if (share_level->mappings) {
                (*selected_out) = share_level;
                return True;
-       } else if (global->mappings) {
+       }
+       if (global->mappings) {
                share_level->mappings = global->mappings;
                (*selected_out) = share_level;
                return True;
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 36d95d5..073ac2f 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -522,15 +522,13 @@ NTSTATUS dptr_create(connection_struct *conn,
                dptr_idleoldest(sconn);
        }
 
-       dptr = talloc(NULL, struct dptr_struct);
+       dptr = talloc_zero(NULL, struct dptr_struct);
        if(!dptr) {
                DEBUG(0,("talloc fail in dptr_create.\n"));
                TALLOC_FREE(dir_hnd);
                return NT_STATUS_NO_MEMORY;
        }
 
-       ZERO_STRUCTP(dptr);
-
        dptr->path = talloc_strdup(dptr, path);
        if (!dptr->path) {
                TALLOC_FREE(dptr);
@@ -773,8 +771,7 @@ static char *dptr_ReadDirName(TALLOC_CTX *ctx,
                return NULL;
 
        /* Create an smb_filename with stream_name == NULL. */
-       ZERO_STRUCT(smb_fname_base);
-       smb_fname_base.base_name = pathreal;
+       smb_fname_base = (struct smb_filename) { .base_name = pathreal };
 
        if (SMB_VFS_STAT(dptr->conn, &smb_fname_base) == 0) {
                *pst = smb_fname_base.st;
@@ -1141,9 +1138,9 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
                       talloc_get_size(dname));
 
                /* Create smb_fname with NULL stream_name. */
-               ZERO_STRUCT(smb_fname);
-               smb_fname.base_name = pathreal;
-               smb_fname.st = sbuf;
+               smb_fname = (struct smb_filename) {
+                       .base_name = pathreal, .st = sbuf
+               };
 
                ok = mode_fn(ctx, private_data, &smb_fname, &mode);
                if (!ok) {
@@ -1655,14 +1652,16 @@ const char *ReadDirName(struct smb_Dir *dirp, long 
*poffset,
                dirp->file_number++;
                *ptalloced = NULL;
                return n;
-       } else if (*poffset == END_OF_DIRECTORY_OFFSET) {
+       }
+
+       if (*poffset == END_OF_DIRECTORY_OFFSET) {
                *poffset = dirp->offset = END_OF_DIRECTORY_OFFSET;
                return NULL;
-       } else {
-               /* A real offset, seek to it. */
-               SeekDir(dirp, *poffset);
        }
 
+       /* A real offset, seek to it. */
+       SeekDir(dirp, *poffset);
+
        while ((n = vfs_readdirname(conn, dirp->dir, sbuf, &talloced))) {
                /* Ignore . and .. - we've already returned them. */
                if (*n == '.') {
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index bdad126..a732bac 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1620,7 +1620,10 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx,
        uint64_t allocation_size = 0;
        uint64_t file_index = 0;
        size_t len = 0;
-       struct timespec mdate_ts, adate_ts, cdate_ts, create_date_ts;
+       struct timespec mdate_ts = {0};
+       struct timespec adate_ts = {0};
+       struct timespec cdate_ts = {0};
+       struct timespec create_date_ts = {0};
        time_t mdate = (time_t)0, adate = (time_t)0, create_date = (time_t)0;
        char *nameptr;
        char *last_entry_ptr;
@@ -1630,11 +1633,6 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx,
        NTSTATUS status;
        struct readdir_attr_data *readdir_attr_data = NULL;
 
-       ZERO_STRUCT(mdate_ts);
-       ZERO_STRUCT(adate_ts);
-       ZERO_STRUCT(create_date_ts);
-       ZERO_STRUCT(cdate_ts);
-
        if (!(mode & FILE_ATTRIBUTE_DIRECTORY)) {
                file_size = get_file_size_stat(&smb_fname->st);
        }


-- 
Samba Shared Repository

Reply via email to