Changeset 627 for trunk/client/src


Ignore:
Timestamp:
Aug 24, 2011, 7:31:18 PM (14 years ago)
Author:
Silvan Scherrer
Message:

Samba Client 2.2: made it build

Location:
trunk/client/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/src/Config.km_

    r626 r627  
    1414SAMBA   = ../../samba-35
    1515TOOLKIT = u:/os2tk45
     16# libz is needed by samba client, if it's found in the path leave the below definition blank. otherwise set it
     17Z_LIBDIR =
    1618
    1719# libsmb 3.3 is threadunsafe, change =0 to =1 in 3.5
  • trunk/client/src/Makefile.kmk

    r584 r627  
    4646ndpsmb_DEFS = $(LIBSMB_THREAD_UNSAFE)
    4747ndpsmb_INCS = ./h ./rc \
    48                 $(SAMBA)/source \
    49                 $(SAMBA)/source/include \
    50                 $(SAMBA)/source/lib/replace \
    51                 $(SAMBA)/source/popt \
    52                 $(SAMBA)/source/lib/talloc \
    53                 $(SAMBA)/source/librpc \
    54                 $(SAMBA)/source/lib/tdb/include \
     48                $(SAMBA)        \
     49                $(SAMBA)/source3 \
     50                $(SAMBA)/source3/include \
     51                $(SAMBA)/lib/replace \
     52                $(SAMBA)/popt \
     53                $(SAMBA)/lib/talloc \
     54                $(SAMBA)/librpc \
     55                $(SAMBA)/lib/tdb/include \
     56                $(SAMBA)/lib/tevent \
    5557                $(GCC_INC)
    5658
    57 ndpsmb_LIBS = libsmbclient.a socket.a
    58 ndpsmb_LIBPATH = $(SAMBA)/source/bin
     59ndpsmb_LIBS = libsmbclient.a socket.a libtalloc.a libtdb.a libwbclient.a z
     60ndpsmb_LIBPATH = $(SAMBA)/source3/bin $(Z_LIBDIR)
    5961
    6062ndpsmb_CLEAN = rc/description.rc $(PATH_BIN)/ndpsmb.dll
  • trunk/client/src/smbwrp.c

    r567 r627  
    147147const char * smbwrp_getVersion()
    148148{
    149         return SAMBA_VERSION_STRING;
     149        return samba_version_string();
    150150}
    151151
     
    566566            dev_type = "A:";
    567567
    568         if (!cli_send_tconX(c, share, dev_type,
    569                             srv->password, strlen(srv->password)+1)) {
     568        if (!NT_STATUS_IS_OK(cli_tcon_andx(c, share, dev_type,
     569                            srv->password, strlen(srv->password)+1))) {
    570570                cli_shutdown(c);
    571571                // if loginerror is != 0 means normal login failed, but anonymous login worked
     
    603603int _System smbwrp_open(cli_state * cli, smbwrp_file * file)
    604604{
    605         int fd = -1;
     605        uint16_t fd = 0;
    606606
    607607        if (!cli || !file || !*file->fname)
     
    615615
    616616        debuglocal(4,"cli_open(%s) attr %08x mode %02x denymode %02x\n", file->fname, file->openattr, file->openmode, file->denymode);
    617         file->fd = cli_open(cli, file->fname, file->openmode, file->denymode);
    618         if (file->fd == -1)
     617        if (!NT_STATUS_IS_OK(cli_open(cli, file->fname, file->openmode, file->denymode, &fd)))
    619618        {       
    620619                return os2cli_errno(cli);
    621620        }
     621        file->fd = fd;
    622622        if (file->openmode & (O_WRONLY | O_RDWR | O_TRUNC | O_CREAT))
    623623        {
     
    780780                        return os2cli_errno(cli);
    781781                }
     782                uint16_t fd = 0;
    782783                file->fd = -1;
    783784                file->offset = 0;                       
     
    785786                file->openmode |= O_TRUNC;
    786787                debuglocal(4,"cli_setnewfileszie : cli_open(%s) attr %08x mode %02x denymode %02x\n", file->fname, file->openattr, file->openmode, file->denymode);
    787                 file->fd = cli_open(cli, file->fname, file->openmode, file->denymode);
    788                 if (file->fd == -1)
     788                if (!NT_STATUS_IS_OK(cli_open(cli, file->fname, file->openmode, file->denymode, &fd)))
    789789                {       
    790790                        return os2cli_errno(cli);
    791791                }
     792                file->fd = fd;
    792793        }       
    793794        return 0;
     
    859860        } else
    860861#endif
    861         if (!cli_unlink(cli, fname))
     862        if (!NT_STATUS_IS_OK(cli_unlink(cli, fname, aSYSTEM | aHIDDEN)))
    862863        {
    863864                return os2cli_errno(cli);
     
    899900                                   NULL, NULL) &&
    900901                    !cli_getattrE(cli, file->fd,
    901                                   NULL, (SMB_BIG_UINT *)&size, NULL, NULL, NULL))
     902                                  NULL, &size, NULL, NULL, NULL))
    902903                {
    903904                        return os2cli_errno(cli);
     
    10071008        {
    10081009                if (!cli_getattrE(cli, file->fd,
    1009                           (unsigned short *)&finfo->attr, (SMB_BIG_UINT *)(&finfo->size), (time_t *)&finfo->ctime, (time_t *)&finfo->atime, (time_t *)&finfo->mtime))
     1010                          (unsigned short *)&finfo->attr, (&finfo->size), (time_t *)&finfo->ctime, (time_t *)&finfo->atime, (time_t *)&finfo->mtime))
    10101011                {
    10111012                        return os2cli_errno(cli);
     
    11281129       
    11291130        switch (level) {
    1130                 case 1: /* OS/2 understands this */
     1131                case SMB_FIND_INFO_STANDARD: /* OS/2 understands this */
    11311132                        /* these dates are converted to GMT by
    11321133                           make_unix_date */
     
    11611162                           between win2000 and win9x for this call
    11621163                           (tridge) */
    1163                         ret = clistr_pull_talloc(ctx, cli, &fname, p,
     1164                        ret = clistr_pull_talloc(ctx, cli->inbuf, &fname, p,
    11641165                                         len+2,
    11651166                                         STR_TERMINATE);
     
    11721173                        return PTR_DIFF(p, base);
    11731174
    1174                 case 2: /* this is what OS/2 uses mostly */
     1175                case SMB_FIND_EA_SIZE: /* this is what OS/2 uses mostly */
    11751176                        /* these dates are converted to GMT by
    11761177                           make_unix_date */
     
    11901191                                return pdata_end - base;
    11911192                        }
    1192                         ret = clistr_pull_talloc(ctx, cli, &fname, p,
     1193                        ret = clistr_pull_talloc(ctx, cli->inbuf, &fname, p,
    11931194                                         len,
    11941195                                         STR_NOALIGN);
     
    12001201                        return PTR_DIFF(p, base) + 1;
    12011202                       
    1202                 case 260: /* NT uses this, but also accepts 2 */
     1203                case SMB_FIND_FILE_BOTH_DIRECTORY_INFO: /* NT uses this, but also accepts 2 */
    12031204                {
    12041205                        size_t namelen, slen;
     
    12531254                                return pdata_end - base;
    12541255                        }         
    1255                         ret = clistr_pull_talloc(ctx, cli, &fname, p,
     1256                        ret = clistr_pull_talloc(ctx, cli->inbuf, &fname, p,
    12561257                                    namelen, 0);
    12571258                        if (ret == (size_t)-1) {
     
    13091310        uint16 setup;
    13101311        char *param;
    1311         const char *mnt;
    13121312        uint32 resume_key = 0;
    13131313        TALLOC_CTX *frame = talloc_stackframe();
    13141314        DATA_BLOB last_name_raw = data_blob(NULL, 0);
    13151315
    1316         /* NT uses 260, OS/2 uses 2. Both accept 1. */
    1317         info_level = (cli->capabilities&CAP_NT_SMBS)?260:2;
     1316        /* NT uses SMB_FIND_FILE_BOTH_DIRECTORY_INFO,
     1317         OS/2 uses SMB_FIND_EA_SIZE. Both accept SMB_FIND_INFO_STANDARD. */
     1318        info_level = (cli->capabilities&CAP_NT_SMBS)?
     1319           SMB_FIND_FILE_BOTH_DIRECTORY_INFO : SMB_FIND_EA_SIZE;
    13181320       
    13191321        debuglocal(4,"list_files level %d. mask <%s>\n", info_level, Mask);
     
    13721374                                p += last_name_raw.length;
    13731375                        } else {
    1374                                 p += clistr_push(cli, param+12, mask, nlen, STR_TERMINATE);
     1376                                p += clistr_push(cli, param+12, mask,
     1377                                              nlen, STR_TERMINATE);
    13751378                        }
    13761379                }
     
    14331436                if (cli_is_error(cli) || !rdata || !rparam)
    14341437                {
    1435                         if (First && info_level == 2)
     1438                        if (First && info_level == SMB_FIND_EA_SIZE)
    14361439                        {
    14371440                                // we have tried query ea size, but now will try without ea size
    1438                                 info_level = 1;
     1441                                info_level = SMB_FIND_INFO_STANDARD;
    14391442                                debuglocal(4,"list_files fallback to level %d\n", info_level);
    14401443                                continue;
     
    14741477                /* we might need the lastname for continuations */
    14751478                for (p2=p,i=0;i<ff_searchcount  && p2 < rdata_end;i++) {
    1476                         if ((info_level == 260) && (i == ff_searchcount-1)) {
     1479                        if ((info_level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) &&
     1480                                        (i == ff_searchcount-1)) {
    14771481                                /* Last entry - fixup the last offset length. */
    14781482                                SIVAL(p2,0,PTR_DIFF((rdata + data_len),p2));
     
    14971501
    14981502                SAFE_FREE(mask);
    1499                 if (ff_searchcount > 0) {
     1503                if (ff_searchcount > 0 && ff_eos == 0 && finfo.fname) {
    15001504                        mask = SMB_STRDUP(finfo.fname);
    15011505                } else {
     
    15361540        }
    15371541
    1538         mnt = cli_cm_get_mntpoint( cli );
    1539 
    15401542        /* see if the server disconnected or the connection otherwise failed */
    15411543        if (cli_is_error(cli)) {
     
    15551557                                break;
    15561558                        }
    1557                         fn( mnt,&finfo, Mask, state );
     1559                        fn(cli->dfs_mountpoint,&finfo, Mask, state );
    15581560
    15591561                        /* Also add the entry to the cache. */
Note: See TracChangeset for help on using the changeset viewer.