Ignore:
Timestamp:
Aug 16, 2008, 12:11:48 PM (17 years ago)
Author:
Yuri Dario
Message:

Merged daemon code, now the plugin calls directly samba client library (still using smbrp code).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/client-1.5/src/smbwrp.c

    r129 r145  
    377377return a connection to a server
    378378*******************************************************/
    379 int _System smbwrp_connect(smbwrp_server * srv, struct cli_state ** cli, int krb5support)
    380 {
     379int _System smbwrp_connect( Resource* pRes, cli_state ** cli)
     380{
     381        smbwrp_server * srv = &pRes->srv;
    381382        char * server = srv->server_name;
    382383        char * share = *(srv->share_name) ? srv->share_name : "IPC$";
     
    440441        }
    441442
    442         if (krb5support == 1){
    443         debuglocal(1,"Kerberos support enabled\n");
    444                 c->use_kerberos = True;}
     443        if (pRes->krb5support == 1)
     444        {
     445            debuglocal(1,"Kerberos support enabled\n");
     446            c->use_kerberos = True;
     447        }
    445448
    446449        if (!cli_session_request(c, &calling, &called)) {
     
    492495        debuglocal(4," tconx ok. cli caps %08x\n", c->capabilities);
    493496
    494         // copy back cli_state
     497        // save cli_state pointer
    495498        *cli = c;
    496499
    497 //      srv->dev = (dev_t)(str_checksum(server) ^ str_checksum(share));
    498 
    499500        return 0;
    500501}
     
    503504close a connection to a server
    504505*******************************************************/
    505 void _System smbwrp_disconnect(struct cli_state ** cli)
    506 {
    507         if (cli)
     506void _System smbwrp_disconnect( Resource* pRes, cli_state * cli)
     507{
     508        if (pRes && cli)
    508509        {
    509510                // this call will free all buffers, close handles and free cli mem
    510                 cli_shutdown(*cli);
    511                 // set to zero because no longer valid
    512                 *cli = 0;
     511                cli_shutdown( cli);
    513512        }
    514513}
     
    933932
    934933// =============================DIRECTORY ROUTINES============================
    935 
     934                                                                                                               
    936935/*****************************************************
    937936add a entry to a directory listing
     
    942941        {
    943942                filelist_state * st  = (filelist_state *)state;
    944                 if (st->add_dir_entry)
    945                 {
    946 debuglocal(8,"adding <%s> %d %d\n", finfo->fname, sizeof(st->finfo), st->datalen);
    947                         memcpy(&st->finfo, finfo, sizeof(st->finfo));
    948                         st->add_dir_entry(state);
    949                 }
    950         }
    951 }
    952 
    953 #if 0
    954 static void smbwrp_dir_add_old(struct file_info *finfo, const char *mask, void *state)
    955 {
    956         if (state && finfo)
    957         {
    958                 filelist_state * st  = (filelist_state *)state;
    959                 if (st->add_dir_entry)
    960                 {
    961                         strncpy(st->finfo.fname, finfo->name, sizeof(st->finfo.fname) - 1);
    962                         st->finfo.size = finfo->size;
    963                         st->finfo.easize = -1;
    964                         st->finfo.attr = finfo->mode;
    965                         st->finfo.ctime = finfo->ctime_ts.tv_sec - get_time_zone(finfo->ctime_ts.tv_sec);
    966                         st->finfo.mtime = finfo->mtime_ts.tv_sec - get_time_zone(finfo->mtime_ts.tv_sec);
    967                         st->finfo.atime = finfo->atime_ts.tv_sec - get_time_zone(finfo->atime_ts.tv_sec);
    968                         st->add_dir_entry(state);
    969                 }
    970         }
    971 }
    972 #endif
     943                char fullname[ _MAX_PATH];
     944                debuglocal(8,"adding <%s> %d %d\n", finfo->fname, sizeof(st->finfo), st->datalen);
     945                memcpy(&st->finfo, finfo, sizeof(st->finfo));
     946                StrCpy(fullname, st->dir);
     947                StrCat(fullname, finfo->fname);
     948                StrCpy(st->finfo.fname, fullname);
     949                getfindinfoL( st->pConn, st->plist, &st->finfo, st->ulAttribute, st->dir_mask);
     950        }
     951}
    973952
    974953static void smbwrp_special_add(const char * name, void * state)
     
    14701449                             smbwrp_dir_add, state) < 0)
    14711450#endif
    1472                 {
     1451                {                                                                             
    14731452                        return os2cli_errno(cli);
    14741453                }
    1475         }
     1454        }                                                                                                                                               
    14761455
    14771456        return 0;
     
    17191698        return 0;
    17201699}
     1700
     1701
     1702char * getlastslash(char * path)
     1703{
     1704        char * p;
     1705        if (!path)
     1706        {
     1707                return NULL;
     1708        }
     1709        for (p = path + strlen(path) - 1; p >= path; p--)
     1710        {
     1711                if (*p == '\\' || *p == '/')
     1712                {
     1713                        return p;
     1714                }
     1715        }
     1716        return NULL;
     1717}
     1718
Note: See TracChangeset for help on using the changeset viewer.