Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

Location:
vendor/current/examples/libsmbclient
Files:
2 added
1 deleted
19 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/examples/libsmbclient/Makefile

    r414 r988  
    88EXTLIB_INCL = `gtk-config --cflags`
    99
    10 DEFS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
     10DEFS = -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
    1111CFLAGS = -O0 -g $(SAMBA_INCL) $(EXTLIB_INCL) $(DEFS)
    1212
  • vendor/current/examples/libsmbclient/get_auth_data_fn.h

    r414 r988  
    1717    char            username[256] = { '\0' };
    1818    char            password[256] = { '\0' };
     19    char           *ret;
    1920
    2021    static int krb5_set = 1;
     
    3738
    3839    fprintf(stdout, "Workgroup: [%s] ", pWorkgroup);
    39     fgets(temp, sizeof(temp), stdin);
     40    ret = fgets(temp, sizeof(temp), stdin);
     41    if (ret == NULL) {
     42            return;
     43    }
    4044   
    4145    if (temp[strlen(temp) - 1] == '\n') /* A new line? */
     
    5054   
    5155    fprintf(stdout, "Username: [%s] ", pUsername);
    52     fgets(temp, sizeof(temp), stdin);
     56    ret = fgets(temp, sizeof(temp), stdin);
     57    if (ret == NULL) {
     58            return;
     59    }
    5360   
    5461    if (temp[strlen(temp) - 1] == '\n') /* A new line? */
     
    6370   
    6471    fprintf(stdout, "Password: ");
    65     fgets(temp, sizeof(temp), stdin);
     72    ret = fgets(temp, sizeof(temp), stdin);
     73    if (ret == NULL) {
     74            return;
     75    }
    6676   
    6777    if (temp[strlen(temp) - 1] == '\n') /* A new line? */
  • vendor/current/examples/libsmbclient/testacl.c

    r414 r988  
    2222{
    2323    int opt;
    24     int flags;
     24    int flags = 0;
    2525    int debug = 0;
    2626    int numeric = 0;
     
    2828    int full_time_names = 0;
    2929    enum acl_mode mode = SMB_ACL_LIST;
    30     static char *the_acl = NULL;
     30    static const char *the_acl = NULL;
    3131    int ret;
    3232    char *p;
    33     char *debugstr;
     33    const char *debugstr;
    3434    char path[1024];
    3535    char value[1024];
  • vendor/current/examples/libsmbclient/testacl2.c

    r414 r988  
    2020int main(int argc, const char *argv[])
    2121{
    22     int i;
    23     int opt;
    2422    int flags;
    2523    int debug = 0;
    26     int numeric = 0;
    27     int full_time_names = 0;
    28     enum acl_mode mode = SMB_ACL_GET;
    2924    static char *the_acl = NULL;
    3025    int ret;
    31     char *p;
    32     char *debugstr;
     26    const char *debugstr;
    3327    char value[1024];
     28    SMBCCTX *context;
    3429
    3530    if (smbc_init(get_auth_data_fn, debug) != 0)
     
    3934    }
    4035
    41     SMBCCTX *context = smbc_set_context(NULL);
     36    context = smbc_set_context(NULL);
    4237    smbc_setOptionFullTimeNames(context, 1);
    4338   
  • vendor/current/examples/libsmbclient/testacl3.c

    r414 r988  
    1111int main(int argc, char * argv[])
    1212{
    13     int             i;
    14     int             fd;
    1513    int             ret;
    1614    int             debug = 0;
    17     int             mode = 0666;
    18     int             savedErrno;
    1915    char            value[2048];
    2016    char            path[2048];
    2117    char *          the_acl;
    2218    char *          p;
    23     time_t          t0;
    24     time_t          t1;
    25     struct stat     st;
    2619    SMBCCTX *       context;
    2720   
  • vendor/current/examples/libsmbclient/testbrowse.c

    r414 r988  
    1010#include "get_auth_data_fn.h"
    1111
    12 static void
    13 no_auth_data_fn(const char * pServer,
    14                 const char * pShare,
    15                 char * pWorkgroup,
    16                 int maxLenWorkgroup,
    17                 char * pUsername,
    18                 int maxLenUsername,
    19                 char * pPassword,
    20                 int maxLenPassword);
    21 
    2212static void browse(char * path,
    2313                   int scan,
     
    3626                              int maxLenPassword);
    3727
    38 int
    39 main(int argc, char * argv[])
     28int main(int argc, const char *argv[])
    4029{
    4130    int                         debug = 0;
     
    4534    int                         scan = 0;
    4635    int                         iterations = -1;
    47     int                         again;
    4836    int                         opt;
    4937    char *                      p;
    50     char *                      q;
    5138    char                        buf[1024];
    5239    poptContext                 pc;
     
    8673    setbuf(stdout, NULL);
    8774
    88     pc = poptGetContext("opendir", argc, (const char **)argv, long_options, 0);
     75    pc = poptGetContext("opendir", argc, argv, long_options, 0);
    8976   
    9077    poptSetOtherOptionHelp(pc, "");
     
    113100        smbc_setFunctionAuthDataWithContext(context,
    114101                                            get_auth_data_with_context_fn);
    115         smbc_setOptionUserData(context, "hello world");
     102        smbc_setOptionUserData(context, strdup("hello world"));
    116103    } else {
    117104        smbc_setFunctionAuthData(context, get_auth_data_fn);
     
    139126    if (scan)
    140127    {
    141         for (;
    142              iterations == -1 || iterations > 0;
    143              iterations = (iterations == -1 ? iterations : --iterations))
    144         {
     128        for (; iterations != 0;) {
     129            if (iterations > 0) {
     130                iterations--;
     131            }
     132
    145133            snprintf(buf, sizeof(buf), "smb://");
    146134            browse(buf, scan, 0);
     
    149137    else
    150138    {
    151         for (;
    152              iterations == -1 || iterations > 0;
    153              iterations = (iterations == -1 ? iterations : --iterations))
    154         {
     139        for (; iterations != 0;) {
     140            if (iterations > 0) {
     141                iterations--;
     142            }
     143
    155144            fputs("url: ", stdout);
    156145            p = fgets(buf, sizeof(buf), stdin);
     
    171160    exit(0);
    172161}
    173 
    174 
    175 static void
    176 no_auth_data_fn(const char * pServer,
    177                 const char * pShare,
    178                 char * pWorkgroup,
    179                 int maxLenWorkgroup,
    180                 char * pUsername,
    181                 int maxLenUsername,
    182                 char * pPassword,
    183                 int maxLenPassword)
    184 {
    185     return;
    186 }
    187 
    188162
    189163static void
     
    214188    char                        buf[1024];
    215189    int                         dir;
    216     struct stat                 stat;
     190    struct stat                 st;
    217191    struct smbc_dirent *        dirent;
    218192
     
    269243            strcat(p, "/");
    270244            strcat(p+1, dirent->name);
    271             if (smbc_stat(path, &stat) < 0)
     245            if (smbc_stat(path, &st) < 0)
    272246            {
    273247                printf(" unknown size (reason %d: %s)",
     
    276250            else
    277251            {
    278                 printf(" size %lu", (unsigned long) stat.st_size);
     252                printf(" size %lu", (unsigned long) st.st_size);
    279253            }
    280254            *p = '\0';
  • vendor/current/examples/libsmbclient/testbrowse2.c

    r414 r988  
    66#include <stdio.h>
    77#include <stdlib.h>
    8 #include <malloc.h>
    98#include <string.h>
    109#include <libsmbclient.h>
    1110
    1211int     debuglevel      = 0;
    13 char    *workgroup      = "NT";
    14 char    *username       = "guest";
    15 char    *password       = "";
     12const char      *workgroup      = "NT";
     13const char      *username       = "guest";
     14const char      *password       = "";
    1615
    1716typedef struct smbitem smbitem;
     
    2423};
    2524
    26 int smbitem_cmp(smbitem *elem1, smbitem *elem2){
    27     return strcmp(elem1->name, elem2->name);
    28 }
    29 
    30 int smbitem_list_count(smbitem *list){
    31     int count = 0;
    32    
    33     while(list != NULL){
    34         list = list->next;
    35         count++;
    36     }
    37     return count;
    38 }
    39 
    40 void smbitem_list_delete(smbitem *list){
    41     smbitem     *elem;
    42    
    43     while(list != NULL){
    44         elem = list;
    45         list = list->next;
    46         free(elem);
    47     }
    48 }
    49 
    50 smbitem* smbitem_list_sort(smbitem *list){
    51     smbitem     *item, **array;
    52     int         count, i;
    53 
    54     if ((count = smbitem_list_count(list)) == 0) return NULL;
    55     if ((array = malloc(count * sizeof(smbitem*))) == NULL){
    56         smbitem_list_delete(list);
    57         return NULL;
    58     }
    59    
    60     for(i = 0; i < count; i++){
    61         array[i] = list;
    62         list = list->next;
    63     }   
    64     qsort(array, count, sizeof(smbitem*), (qsort_cmp)smbitem_cmp);
    65    
    66     for(i = 0; i < count - 1; i++) array[i]->next = array[i + 1];
    67     array[count - 1]->next = NULL;
    68    
    69     list = array[0];
    70     free(array);
    71     return list;
    72 }
    73 
    74 void smbc_auth_fn(
     25static void smbc_auth_fn(
    7526                const char      *server,
    7627                const char      *share,
     
    8940}
    9041
    91 SMBCCTX* create_smbctx(){
     42static SMBCCTX* create_smbctx(void){
    9243    SMBCCTX     *ctx;
    9344
     
    10556}
    10657
    107 void delete_smbctx(SMBCCTX* ctx){
     58static void delete_smbctx(SMBCCTX* ctx){
    10859    smbc_getFunctionPurgeCachedServers(ctx)(ctx);
    10960    smbc_free_context(ctx, 1);
    11061}
    11162
    112 smbitem* get_smbitem_list(SMBCCTX *ctx, char *smb_path){
     63static smbitem* get_smbitem_list(SMBCCTX *ctx, char *smb_path){
    11364    SMBCFILE            *fd;
    11465    struct smbc_dirent  *dirent;
     
    13586}
    13687
    137 void print_smb_path(char *group, char *path){
     88static void print_smb_path(const char *group, const char *path){
    13889    if ((strlen(group) == 0) && (strlen(path) == 0)) printf("/\n");
    13990    else if (strlen(path) == 0) printf("/%s\n", group);
     
    14495}
    14596
    146 void recurse(SMBCCTX *ctx, char *smb_group, char *smb_path, int maxlen){
     97static void recurse(SMBCCTX *ctx, const char *smb_group, char *smb_path, int maxlen){
    14798    int         len;
    14899    smbitem     *list, *item;
  • vendor/current/examples/libsmbclient/testchmod.c

    r414 r988  
    99int main(int argc, char * argv[])
    1010{
    11     int             ret;
    1211    int             debug = 0;
    1312    int             mode = 0666;
    14     char            buffer[16384];
    15     char *          pSmbPath = NULL;
     13    const char *          pSmbPath = NULL;
    1614    struct stat     st;
    1715   
     
    4543    }
    4644   
    47     printf("\nBefore chmod: mode = %04o\n", st.st_mode);
     45    printf("\nBefore chmod: mode = %04o\n", (unsigned int)st.st_mode);
    4846   
    4947    if (smbc_chmod(pSmbPath, mode) < 0)
     
    5957    }
    6058   
    61     printf("After chmod: mode = %04o\n", st.st_mode);
     59    printf("After chmod: mode = %04o\n", (unsigned int)st.st_mode);
    6260   
    6361    return 0;
  • vendor/current/examples/libsmbclient/testctx.c

    r740 r988  
    22#include <stdlib.h>
    33#include <stdio.h>
     4#include <string.h>
    45
    5 void create_and_destroy_context (void)
     6static void create_and_destroy_context (void)
    67{
    78  int i;
     
    1011  /* Both should do the same thing */
    1112  smbc_setOptionDebugToStderr(ctx, 1);
    12   smbc_option_set(ctx, "debug_to_stderr", 1);
     13  smbc_option_set(ctx, strdup("debug_to_stderr"), 1);
    1314  smbc_setDebug(ctx, 1);
    1415  i = smbc_getDebug(ctx);
  • vendor/current/examples/libsmbclient/testfstatvfs.c

    r414 r988  
    1212int main(int argc, char * argv[])
    1313{
    14     int             i;
    1514    int             fd;
    1615    int             ret;
     
    8887            printf("Available Files: %llu\n",
    8988                   (unsigned long long) statvfsbuf.f_favail);
     89#ifdef HAVE_FSID_INT
    9090            printf("File System ID: %lu\n",
    9191                   (unsigned long) statvfsbuf.f_fsid);
     92#endif
    9293            printf("\n");
    9394
  • vendor/current/examples/libsmbclient/testread.c

    r414 r988  
    1111int main(int argc, char * argv[])
    1212{
    13     int             i;
    1413    int             fd;
    1514    int             ret;
    1615    int             debug = 0;
    17     int             mode = 0666;
    1816    int             savedErrno;
    1917    char            buffer[2048];
    2018    char            path[2048];
    2119    char *          p;
    22     time_t          t0;
    23     time_t          t1;
    24     struct stat     st;
    2520   
    2621    smbc_init(get_auth_data_fn, debug);
  • vendor/current/examples/libsmbclient/testsmbc.c

    r414 r988  
    3030#include "get_auth_data_fn.h"
    3131
    32 int global_id = 0;
    33 
    34 void print_list_fn(struct print_job_info *pji)
    35 {
    36 
    37   fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %lu, User: %s, Name: %s\n",
    38           pji->id,
    39           pji->priority,
    40           (unsigned long) pji->size,
    41           pji->user,
    42           pji->name);
    43 
    44   global_id = pji->id;
    45 
    46 }
    47 
    4832int main(int argc, char *argv[])
    4933{
    50   int err, fd, dh1, dh2, dh3, dsize, dirc;
     34  int err, fd, dh1, dsize, dirc;
    5135  const char *file = "smb://samba/public/testfile.txt";
    5236  const char *file2 = "smb://samba/public/testfile2.txt";
     
    7559    }
    7660
    77     fprintf(stdout, "Directory handles: %u, %u, %u\n", dh1, dh2, dh3);
     61    fprintf(stdout, "Directory handle: %u\n", dh1);
    7862
    7963    /* Now, list those directories, but in funny ways ... */
     
    131115  /* Now, write some date to the file ... */
    132116
    133   bzero(buff, sizeof(buff));
     117  memset(buff, '\0', sizeof(buff));
    134118  strcpy(buff, "Some test data for the moment ...");
    135119
     
    257241
    258242  fprintf(stdout, "Stat'ed file:   %s. Size = %d, mode = %04X\n", file2,
    259           (int)st2.st_size, st2.st_mode);
     243          (int)st2.st_size, (unsigned int)st2.st_mode);
    260244  fprintf(stdout, "    time: %s\n", ctime(&st2.st_atime));
    261245  fprintf(stdout, "Earlier stat:   %s, Size = %d, mode = %04X\n", file,
    262           (int)st1.st_size, st1.st_mode);
     246          (int)st1.st_size, (unsigned int)st1.st_mode);
    263247  fprintf(stdout, "    time: %s\n", ctime(&st1.st_atime));
    264248
  • vendor/current/examples/libsmbclient/teststat.c

    r414 r988  
    1010{
    1111    int             debug = 0;
    12     char            buffer[16384];
    13     char            mtime[32];
    14     char            ctime[32];
    15     char            atime[32];
    16     char *          pSmbPath = NULL;
    17     char *          pLocalPath = NULL;
     12    char            m_time[32];
     13    char            c_time[32];
     14    char            a_time[32];
     15    const char *          pSmbPath = NULL;
     16    const char *          pLocalPath = NULL;
    1817    struct stat     st;
    1918   
     
    4948    }
    5049   
    51     printf("\nSAMBA\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
    52            st.st_mtime, ctime_r(&st.st_mtime, mtime),
    53            st.st_ctime, ctime_r(&st.st_ctime, ctime),
    54            st.st_atime, ctime_r(&st.st_atime, atime));
     50    printf("\nSAMBA\n mtime:%lld/%s ctime:%lld/%s atime:%lld/%s\n",
     51           (long long)st.st_mtime, ctime_r(&st.st_mtime, m_time),
     52           (long long)st.st_ctime, ctime_r(&st.st_ctime, c_time),
     53           (long long)st.st_atime, ctime_r(&st.st_atime, a_time));
    5554   
    5655    if (pLocalPath != NULL)
     
    6261        }
    6362       
    64         printf("LOCAL\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
    65                st.st_mtime, ctime_r(&st.st_mtime, mtime),
    66                st.st_ctime, ctime_r(&st.st_ctime, ctime),
    67                st.st_atime, ctime_r(&st.st_atime, atime));
     63        printf("LOCAL\n mtime:%lld/%s ctime:%lld/%s atime:%lld/%s\n",
     64               (long long)st.st_mtime, ctime_r(&st.st_mtime, m_time),
     65               (long long)st.st_ctime, ctime_r(&st.st_ctime, c_time),
     66               (long long)st.st_atime, ctime_r(&st.st_atime, a_time));
    6867    }
    6968
  • vendor/current/examples/libsmbclient/teststat2.c

    r740 r988  
    3535                   const char * pLocalPath)
    3636{
    37         //char *pSmbPath = 0;
    3837        struct stat st;
    39         char mtime[32];
    40         char ctime[32];
    41         char atime[32];
     38        char m_time[32];
     39        char c_time[32];
     40        char a_time[32];
    4241       
    4342        smbc_init(get_auth_data_fn, 0);
     
    4948        }
    5049       
    51         printf("SAMBA\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
    52                st.st_mtime, ctime_r(&st.st_mtime, mtime),
    53                st.st_ctime, ctime_r(&st.st_ctime, ctime),
    54                st.st_atime, ctime_r(&st.st_atime, atime));
     50        printf("SAMBA\n mtime:%lld/%s ctime:%lld/%s atime:%lld/%s\n",
     51               (long long)st.st_mtime, ctime_r(&st.st_mtime, m_time),
     52               (long long)st.st_ctime, ctime_r(&st.st_ctime, c_time),
     53               (long long)st.st_atime, ctime_r(&st.st_atime, a_time));
    5554       
    5655       
    57         // check the stat on this file
     56        /* check the stat on this file */
    5857        if (stat(pLocalPath, &st) < 0)
    5958        {
     
    6261        }
    6362       
    64         printf("LOCAL\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
    65                st.st_mtime, ctime_r(&st.st_mtime, mtime),
    66                st.st_ctime, ctime_r(&st.st_ctime, ctime),
    67                st.st_atime, ctime_r(&st.st_atime, atime));
     63        printf("LOCAL\n mtime:%lld/%s ctime:%lld/%s atime:%lld/%s\n",
     64               (long long)st.st_mtime, ctime_r(&st.st_mtime, m_time),
     65               (long long)st.st_ctime, ctime_r(&st.st_ctime, c_time),
     66               (long long)st.st_atime, ctime_r(&st.st_atime, a_time));
    6867       
    6968       
    7069        return 0;
    7170}
    72 
  • vendor/current/examples/libsmbclient/teststat3.c

    r414 r988  
    1818        struct stat     st1;
    1919        struct stat     st2;
    20         char            mtime[32];
    21         char            ctime[32];
    22         char            atime[32];
    2320        char *          pUrl = argv[1];
    2421
  • vendor/current/examples/libsmbclient/teststatvfs.c

    r414 r988  
    1212int main(int argc, char * argv[])
    1313{
    14     int             i;
    15     int             fd;
    1614    int             ret;
    1715    int             debug = 0;
    1816    char *          p;
    1917    char            path[2048];
    20     struct stat     statbuf;
    2118    struct statvfs  statvfsbuf;
    2219   
     
    6259            printf("Available Files: %llu\n",
    6360                   (unsigned long long) statvfsbuf.f_favail);
     61#ifdef HAVE_FSID_INT
    6462            printf("File System ID: %lu\n",
    6563                   (unsigned long) statvfsbuf.f_fsid);
     64#endif
    6665            printf("\n");
    6766
  • vendor/current/examples/libsmbclient/testtruncate.c

    r414 r988  
    1515    int             savedErrno;
    1616    char            buffer[128];
    17     char *          pSmbPath = NULL;
    18     char *          pLocalPath = NULL;
    1917    struct stat     st;
    2018   
  • vendor/current/examples/libsmbclient/testutime.c

    r414 r988  
     1#include "config.h"
    12#include <stdio.h>
    23#include <unistd.h>
     
    910int main(int argc, char * argv[])
    1011{
    11     int             ret;
    1212    int             debug = 0;
    13     char            buffer[16384];
    14     char            mtime[32];
    15     char            ctime[32];
    16     char            atime[32];
    17     char *          pSmbPath = NULL;
     13    char            m_time[32];
     14    char            c_time[32];
     15    char            a_time[32];
     16    const char *          pSmbPath = NULL;
    1817    time_t          t = time(NULL);
    19     struct tm       tm;
    2018    struct stat     st;
    2119    struct utimbuf  utimbuf;
     
    5048    }
    5149   
    52     printf("Before\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
    53            st.st_mtime, ctime_r(&st.st_mtime, mtime),
    54            st.st_ctime, ctime_r(&st.st_ctime, ctime),
    55            st.st_atime, ctime_r(&st.st_atime, atime));
     50    printf("Before\n mtime:%lld/%s ctime:%lld/%s atime:%lld/%s\n",
     51           (long long)st.st_mtime, ctime_r(&st.st_mtime, m_time),
     52           (long long)st.st_ctime, ctime_r(&st.st_ctime, c_time),
     53           (long long)st.st_atime, ctime_r(&st.st_atime, a_time));
    5654   
    5755    utimbuf.actime = t;         /* unchangable (wont change) */
     
    6967    }
    7068   
    71     printf("After\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
    72            st.st_mtime, ctime_r(&st.st_mtime, mtime),
    73            st.st_ctime, ctime_r(&st.st_ctime, ctime),
    74            st.st_atime, ctime_r(&st.st_atime, atime));
     69    printf("After\n mtime:%lld/%s ctime:%lld/%s atime:%lld/%s\n",
     70           (long long)st.st_mtime, ctime_r(&st.st_mtime, m_time),
     71           (long long)st.st_ctime, ctime_r(&st.st_ctime, c_time),
     72           (long long)st.st_atime, ctime_r(&st.st_atime, a_time));
    7573   
    7674    return 0;
  • vendor/current/examples/libsmbclient/testwrite.c

    r414 r988  
    1111int main(int argc, char * argv[])
    1212{
    13     int             i;
    1413    int             fd;
    1514    int             ret;
    1615    int             debug = 0;
    17     int             mode = 0666;
    1816    int             savedErrno;
    1917    char            buffer[2048];
    2018    char            path[2048];
    2119    char *          p;
    22     time_t          t0;
    23     time_t          t1;
    24     struct stat     st;
    2520   
    2621    smbc_init(get_auth_data_fn, debug);
Note: See TracChangeset for help on using the changeset viewer.