[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Oct 19 18:30:01 MDT 2011


The branch, master has been updated
       via  019f643 Fix a boatload of warnings in the examples.
       via  f64f91f Fix error return to be NT_STATUS_NOT_A_DIRECTORY.
       via  7b4edc1 Make use of the "dir_exists" we already have on directory open.
      from  3712006 dsdb: improve debug message

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


- Log -----------------------------------------------------------------
commit 019f643c693b4c6de3da78159d8c4507b924d93a
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Oct 19 14:52:41 2011 -0700

    Fix a boatload of warnings in the examples.
    
    Autobuild-User: Jeremy Allison <jra at samba.org>
    Autobuild-Date: Thu Oct 20 02:29:52 CEST 2011 on sn-devel-104

commit f64f91f96f71271186b3e171d24f0d0137620cba
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Oct 19 14:25:45 2011 -0700

    Fix error return to be NT_STATUS_NOT_A_DIRECTORY.

commit 7b4edc11e3c0eb9b9a8717e28b70cb00e95cf7ec
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Oct 19 14:23:38 2011 -0700

    Make use of the "dir_exists" we already have on directory open.

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

Summary of changes:
 examples/libsmbclient/testacl.c      |    4 +-
 examples/libsmbclient/testacl2.c     |    8 +----
 examples/libsmbclient/testacl3.c     |    7 ----
 examples/libsmbclient/testbrowse.c   |   35 ++----------------
 examples/libsmbclient/testbrowse2.c  |   66 +++++-----------------------------
 examples/libsmbclient/testchmod.c    |    4 +--
 examples/libsmbclient/testfstatvfs.c |    1 -
 examples/libsmbclient/testread.c     |    5 ---
 examples/libsmbclient/teststat.c     |   23 ++++++------
 examples/libsmbclient/teststat2.c    |   22 +++++------
 examples/libsmbclient/teststat3.c    |    3 --
 examples/libsmbclient/teststatvfs.c  |    3 --
 examples/libsmbclient/testtruncate.c |    2 -
 examples/libsmbclient/testutime.c    |   23 +++++-------
 examples/libsmbclient/testwrite.c    |    5 ---
 source3/smbd/open.c                  |   40 +++++++++++++++-----
 16 files changed, 78 insertions(+), 173 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/libsmbclient/testacl.c b/examples/libsmbclient/testacl.c
index a57dd4a..b602c5b 100644
--- a/examples/libsmbclient/testacl.c
+++ b/examples/libsmbclient/testacl.c
@@ -27,10 +27,10 @@ int main(int argc, const char *argv[])
     int stat_and_retry = 0;
     int full_time_names = 0;
     enum acl_mode mode = SMB_ACL_LIST;
-    static char *the_acl = NULL;
+    static const char *the_acl = NULL;
     int ret;
     char *p;
-    char *debugstr;
+    const char *debugstr;
     char path[1024];
     char value[1024];
     poptContext pc;
diff --git a/examples/libsmbclient/testacl2.c b/examples/libsmbclient/testacl2.c
index d2a97cf..ef044f8 100644
--- a/examples/libsmbclient/testacl2.c
+++ b/examples/libsmbclient/testacl2.c
@@ -19,17 +19,11 @@ enum acl_mode
 
 int main(int argc, const char *argv[])
 {
-    int i;
-    int opt;
     int flags;
     int debug = 0;
-    int numeric = 0;
-    int full_time_names = 0;
-    enum acl_mode mode = SMB_ACL_GET;
     static char *the_acl = NULL;
     int ret;
-    char *p;
-    char *debugstr;
+    const char *debugstr;
     char value[1024];
 
     if (smbc_init(get_auth_data_fn, debug) != 0)
diff --git a/examples/libsmbclient/testacl3.c b/examples/libsmbclient/testacl3.c
index 4ef6e80..f34e273 100644
--- a/examples/libsmbclient/testacl3.c
+++ b/examples/libsmbclient/testacl3.c
@@ -10,19 +10,12 @@
 
 int main(int argc, char * argv[]) 
 { 
-    int             i;
-    int             fd;
     int             ret;
     int             debug = 0;
-    int             mode = 0666;
-    int             savedErrno;
     char            value[2048]; 
     char            path[2048];
     char *          the_acl;
     char *          p;
-    time_t          t0;
-    time_t          t1;
-    struct stat     st; 
     SMBCCTX *       context;
     
     smbc_init(get_auth_data_fn, debug); 
diff --git a/examples/libsmbclient/testbrowse.c b/examples/libsmbclient/testbrowse.c
index c3fb394..2ae7ca1 100644
--- a/examples/libsmbclient/testbrowse.c
+++ b/examples/libsmbclient/testbrowse.c
@@ -9,16 +9,6 @@
 #include <libsmbclient.h>
 #include "get_auth_data_fn.h"
 
-static void
-no_auth_data_fn(const char * pServer,
-                const char * pShare,
-                char * pWorkgroup,
-                int maxLenWorkgroup,
-                char * pUsername,
-                int maxLenUsername,
-                char * pPassword,
-                int maxLenPassword);
-
 static void browse(char * path,
                    int scan,
                    int indent);
@@ -44,10 +34,8 @@ main(int argc, char * argv[])
     int                         context_auth = 0;
     int                         scan = 0;
     int                         iterations = -1;
-    int                         again;
     int                         opt;
     char *                      p;
-    char *                      q;
     char                        buf[1024];
     poptContext                 pc;
     SMBCCTX *                   context;
@@ -112,7 +100,7 @@ main(int argc, char * argv[])
     if (context_auth) {
         smbc_setFunctionAuthDataWithContext(context,
                                             get_auth_data_with_context_fn);
-        smbc_setOptionUserData(context, "hello world");
+        smbc_setOptionUserData(context, (void *)"hello world");
     } else {
         smbc_setFunctionAuthData(context, get_auth_data_fn);
     }
@@ -171,21 +159,6 @@ main(int argc, char * argv[])
     exit(0);
 }
 
-
-static void
-no_auth_data_fn(const char * pServer,
-                const char * pShare,
-                char * pWorkgroup,
-                int maxLenWorkgroup,
-                char * pUsername,
-                int maxLenUsername,
-                char * pPassword,
-                int maxLenPassword)
-{
-    return;
-}
-
-
 static void
 get_auth_data_with_context_fn(SMBCCTX * context,
                               const char * pServer,
@@ -213,7 +186,7 @@ static void browse(char * path, int scan, int indent)
     char *                      p;
     char                        buf[1024];
     int                         dir;
-    struct stat                 stat;
+    struct stat                 st;
     struct smbc_dirent *        dirent;
 
     if (! scan)
@@ -268,14 +241,14 @@ static void browse(char * path, int scan, int indent)
             p = path + strlen(path);
             strcat(p, "/");
             strcat(p+1, dirent->name);
-            if (smbc_stat(path, &stat) < 0)
+            if (smbc_stat(path, &st) < 0)
             {
                 printf(" unknown size (reason %d: %s)",
                        errno, strerror(errno));
             }
             else
             {
-                printf(" size %lu", (unsigned long) stat.st_size);
+                printf(" size %lu", (unsigned long) st.st_size);
             }
             *p = '\0';
 
diff --git a/examples/libsmbclient/testbrowse2.c b/examples/libsmbclient/testbrowse2.c
index 0ac1d72..fd0a4e8 100644
--- a/examples/libsmbclient/testbrowse2.c
+++ b/examples/libsmbclient/testbrowse2.c
@@ -10,9 +10,9 @@
 #include <libsmbclient.h>
 
 int	debuglevel	= 0;
-char	*workgroup	= "NT";
-char	*username	= "guest";
-char	*password	= "";
+const char	*workgroup	= "NT";
+const char	*username	= "guest";
+const char	*password	= "";
 
 typedef struct smbitem smbitem;
 typedef int(*qsort_cmp)(const void *, const void *);
@@ -23,55 +23,7 @@ struct smbitem{
     char	name[1];
 };
 
-int smbitem_cmp(smbitem *elem1, smbitem *elem2){
-    return strcmp(elem1->name, elem2->name);
-}
-
-int smbitem_list_count(smbitem *list){
-    int count = 0;
-    
-    while(list != NULL){
-	list = list->next;
-	count++;
-    }
-    return count;
-}
-
-void smbitem_list_delete(smbitem *list){
-    smbitem	*elem;
-    
-    while(list != NULL){
-	elem = list;
-	list = list->next;
-	free(elem);
-    }
-}
-
-smbitem* smbitem_list_sort(smbitem *list){
-    smbitem	*item, **array;
-    int		count, i;
-
-    if ((count = smbitem_list_count(list)) == 0) return NULL;
-    if ((array = malloc(count * sizeof(smbitem*))) == NULL){
-	smbitem_list_delete(list);
-	return NULL;
-    }
-    
-    for(i = 0; i < count; i++){
-	array[i] = list;
-	list = list->next;
-    }	
-    qsort(array, count, sizeof(smbitem*), (qsort_cmp)smbitem_cmp);
-    
-    for(i = 0; i < count - 1; i++) array[i]->next = array[i + 1];
-    array[count - 1]->next = NULL;
-    
-    list = array[0];
-    free(array);
-    return list;
-}
-
-void smbc_auth_fn(
+static void smbc_auth_fn(
                 const char      *server,
 		const char      *share,
 		char            *wrkgrp, int wrkgrplen,
@@ -88,7 +40,7 @@ void smbc_auth_fn(
     strncpy(passwd, password, passwdlen - 1); passwd[passwdlen - 1] = 0;
 }
 
-SMBCCTX* create_smbctx(){
+static SMBCCTX* create_smbctx(void){
     SMBCCTX	*ctx;
 
     if ((ctx = smbc_new_context()) == NULL) return NULL;
@@ -104,12 +56,12 @@ SMBCCTX* create_smbctx(){
     return ctx;
 }
 
-void delete_smbctx(SMBCCTX* ctx){
+static void delete_smbctx(SMBCCTX* ctx){
     smbc_getFunctionPurgeCachedServers(ctx)(ctx);
     smbc_free_context(ctx, 1);
 }
 
-smbitem* get_smbitem_list(SMBCCTX *ctx, char *smb_path){
+static smbitem* get_smbitem_list(SMBCCTX *ctx, char *smb_path){
     SMBCFILE		*fd;
     struct smbc_dirent	*dirent;
     smbitem		*list = NULL, *item;
@@ -134,7 +86,7 @@ smbitem* get_smbitem_list(SMBCCTX *ctx, char *smb_path){
         
 }
 
-void print_smb_path(char *group, char *path){
+static void print_smb_path(const char *group, const char *path){
     if ((strlen(group) == 0) && (strlen(path) == 0)) printf("/\n");
     else if (strlen(path) == 0) printf("/%s\n", group);
     else{
@@ -143,7 +95,7 @@ void print_smb_path(char *group, char *path){
     }
 }
 
-void recurse(SMBCCTX *ctx, char *smb_group, char *smb_path, int maxlen){
+static void recurse(SMBCCTX *ctx, const char *smb_group, char *smb_path, int maxlen){
     int 	len;
     smbitem	*list, *item;
     SMBCCTX	*ctx1;
diff --git a/examples/libsmbclient/testchmod.c b/examples/libsmbclient/testchmod.c
index 774daae..4473146 100644
--- a/examples/libsmbclient/testchmod.c
+++ b/examples/libsmbclient/testchmod.c
@@ -8,11 +8,9 @@
 
 int main(int argc, char * argv[]) 
 { 
-    int             ret;
     int             debug = 0;
     int             mode = 0666;
-    char            buffer[16384]; 
-    char *          pSmbPath = NULL;
+    const char *          pSmbPath = NULL;
     struct stat     st; 
     
     if (argc == 1)
diff --git a/examples/libsmbclient/testfstatvfs.c b/examples/libsmbclient/testfstatvfs.c
index 73f42d4..2442404 100644
--- a/examples/libsmbclient/testfstatvfs.c
+++ b/examples/libsmbclient/testfstatvfs.c
@@ -11,7 +11,6 @@
 
 int main(int argc, char * argv[]) 
 { 
-    int             i;
     int             fd;
     int             ret;
     int             debug = 0;
diff --git a/examples/libsmbclient/testread.c b/examples/libsmbclient/testread.c
index 3f94884..87625e8 100644
--- a/examples/libsmbclient/testread.c
+++ b/examples/libsmbclient/testread.c
@@ -10,18 +10,13 @@
 
 int main(int argc, char * argv[]) 
 { 
-    int             i;
     int             fd;
     int             ret;
     int             debug = 0;
-    int             mode = 0666;
     int             savedErrno;
     char            buffer[2048]; 
     char            path[2048];
     char *          p;
-    time_t          t0;
-    time_t          t1;
-    struct stat     st; 
     
     smbc_init(get_auth_data_fn, debug); 
     
diff --git a/examples/libsmbclient/teststat.c b/examples/libsmbclient/teststat.c
index 86c69e4..f36639e 100644
--- a/examples/libsmbclient/teststat.c
+++ b/examples/libsmbclient/teststat.c
@@ -9,12 +9,11 @@
 int main(int argc, char * argv[]) 
 { 
     int             debug = 0;
-    char            buffer[16384]; 
-    char            mtime[32];
-    char            ctime[32];
-    char            atime[32];
-    char *          pSmbPath = NULL;
-    char *          pLocalPath = NULL;
+    char            m_time[32];
+    char            c_time[32];
+    char            a_time[32];
+    const char *          pSmbPath = NULL;
+    const char *          pLocalPath = NULL;
     struct stat     st; 
     
     if (argc == 1)
@@ -49,9 +48,9 @@ int main(int argc, char * argv[])
     }
     
     printf("\nSAMBA\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
-           st.st_mtime, ctime_r(&st.st_mtime, mtime),
-           st.st_ctime, ctime_r(&st.st_ctime, ctime),
-           st.st_atime, ctime_r(&st.st_atime, atime)); 
+           st.st_mtime, ctime_r(&st.st_mtime, m_time),
+           st.st_ctime, ctime_r(&st.st_ctime, c_time),
+           st.st_atime, ctime_r(&st.st_atime, a_time)); 
     
     if (pLocalPath != NULL)
     {
@@ -62,9 +61,9 @@ int main(int argc, char * argv[])
         }
         
         printf("LOCAL\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
-               st.st_mtime, ctime_r(&st.st_mtime, mtime),
-               st.st_ctime, ctime_r(&st.st_ctime, ctime),
-               st.st_atime, ctime_r(&st.st_atime, atime)); 
+               st.st_mtime, ctime_r(&st.st_mtime, m_time),
+               st.st_ctime, ctime_r(&st.st_ctime, c_time),
+               st.st_atime, ctime_r(&st.st_atime, a_time)); 
     }
 
     return 0; 
diff --git a/examples/libsmbclient/teststat2.c b/examples/libsmbclient/teststat2.c
index b5e6b43..fcd3e30 100644
--- a/examples/libsmbclient/teststat2.c
+++ b/examples/libsmbclient/teststat2.c
@@ -34,11 +34,10 @@ int main(int argc, char* argv[])
 static int gettime(const char * pUrl,
                    const char * pLocalPath)
 {
-        //char *pSmbPath = 0;
         struct stat st;
-        char mtime[32];
-        char ctime[32];
-        char atime[32];
+        char m_time[32];
+        char c_time[32];
+        char a_time[32];
         
         smbc_init(get_auth_data_fn, 0);
         
@@ -49,12 +48,12 @@ static int gettime(const char * pUrl,
         }
         
         printf("SAMBA\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
-               st.st_mtime, ctime_r(&st.st_mtime, mtime),
-               st.st_ctime, ctime_r(&st.st_ctime, ctime),
-               st.st_atime, ctime_r(&st.st_atime, atime)); 
+               st.st_mtime, ctime_r(&st.st_mtime, m_time),
+               st.st_ctime, ctime_r(&st.st_ctime, c_time),
+               st.st_atime, ctime_r(&st.st_atime, a_time)); 
         
         
-        // check the stat on this file
+        /* check the stat on this file */
         if (stat(pLocalPath, &st) < 0)
         {
                 perror("stat");
@@ -62,11 +61,10 @@ static int gettime(const char * pUrl,
         }
         
         printf("LOCAL\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
-               st.st_mtime, ctime_r(&st.st_mtime, mtime),
-               st.st_ctime, ctime_r(&st.st_ctime, ctime),
-               st.st_atime, ctime_r(&st.st_atime, atime));
+               st.st_mtime, ctime_r(&st.st_mtime, m_time),
+               st.st_ctime, ctime_r(&st.st_ctime, c_time),
+               st.st_atime, ctime_r(&st.st_atime, a_time));
         
         
         return 0;
 }
-
diff --git a/examples/libsmbclient/teststat3.c b/examples/libsmbclient/teststat3.c
index 26348b3..3efe51d 100644
--- a/examples/libsmbclient/teststat3.c
+++ b/examples/libsmbclient/teststat3.c
@@ -17,9 +17,6 @@ int main(int argc, char* argv[])
         int             fd;
         struct stat     st1;
         struct stat     st2;
-        char            mtime[32];
-        char            ctime[32];
-        char            atime[32];
         char *          pUrl = argv[1];
 
         if(argc != 2)
diff --git a/examples/libsmbclient/teststatvfs.c b/examples/libsmbclient/teststatvfs.c
index b7e6b51..5c69122 100644
--- a/examples/libsmbclient/teststatvfs.c
+++ b/examples/libsmbclient/teststatvfs.c
@@ -11,13 +11,10 @@
 
 int main(int argc, char * argv[]) 
 { 
-    int             i;
-    int             fd;
     int             ret;
     int             debug = 0;
     char *          p;
     char            path[2048];
-    struct stat     statbuf;
     struct statvfs  statvfsbuf;
     
     smbc_init(get_auth_data_fn, debug); 
diff --git a/examples/libsmbclient/testtruncate.c b/examples/libsmbclient/testtruncate.c
index 8882acd..3e29ad2 100644
--- a/examples/libsmbclient/testtruncate.c
+++ b/examples/libsmbclient/testtruncate.c
@@ -14,8 +14,6 @@ int main(int argc, char * argv[])
     int             debug = 0;
     int             savedErrno;
     char            buffer[128];
-    char *          pSmbPath = NULL;
-    char *          pLocalPath = NULL;
     struct stat     st; 
     
     if (argc != 2)
diff --git a/examples/libsmbclient/testutime.c b/examples/libsmbclient/testutime.c
index 8624ca1..2b3c40b 100644
--- a/examples/libsmbclient/testutime.c
+++ b/examples/libsmbclient/testutime.c
@@ -9,15 +9,12 @@
 
 int main(int argc, char * argv[]) 
 { 
-    int             ret;
     int             debug = 0;
-    char            buffer[16384]; 
-    char            mtime[32];
-    char            ctime[32];
-    char            atime[32];
-    char *          pSmbPath = NULL;
+    char            m_time[32];
+    char            c_time[32];
+    char            a_time[32];
+    const char *          pSmbPath = NULL;
     time_t          t = time(NULL);
-    struct tm       tm;
     struct stat     st;
     struct utimbuf  utimbuf;
     
@@ -51,9 +48,9 @@ int main(int argc, char * argv[])
     }
     
     printf("Before\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
-           st.st_mtime, ctime_r(&st.st_mtime, mtime),
-           st.st_ctime, ctime_r(&st.st_ctime, ctime),
-           st.st_atime, ctime_r(&st.st_atime, atime)); 
+           st.st_mtime, ctime_r(&st.st_mtime, m_time),
+           st.st_ctime, ctime_r(&st.st_ctime, c_time),
+           st.st_atime, ctime_r(&st.st_atime, a_time)); 
     


-- 
Samba Shared Repository


More information about the samba-cvs mailing list