Ignore:
Timestamp:
Mar 25, 2007, 12:49:08 PM (18 years ago)
Author:
Yuri Dario
Message:

Client code changes for 3.0.25 upgrade.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/samba-3.0.25pre1/source/ndpsmb/smbwrp.c

    r5 r6  
    3535        initialised = 1;
    3636
    37         init_globals();
     37        load_case_tables();
     38
     39        init_globals( True);
    3840
    3941        load_interfaces();
     
    191193
    192194        if (c_time) {
    193                 *c_time = interpret_long_date(rdata+0) - cli->serverzone;
     195                *c_time = convert_timespec_to_time_t(interpret_long_date(rdata+0)) - cli->serverzone;
    194196        }
    195197        if (a_time) {
    196                 *a_time = interpret_long_date(rdata+8) - cli->serverzone;
     198                *a_time = convert_timespec_to_time_t(interpret_long_date(rdata+8)) - cli->serverzone;
    197199        }
    198200        if (m_time) {
    199                 *m_time = interpret_long_date(rdata+16) - cli->serverzone;
     201                *m_time = convert_timespec_to_time_t(interpret_long_date(rdata+16)) - cli->serverzone;
    200202        }
    201203        if (w_time) {
    202                 *w_time = interpret_long_date(rdata+24) - cli->serverzone;
     204                *w_time = convert_timespec_to_time_t(interpret_long_date(rdata+24)) - cli->serverzone;
    203205        }
    204206        if (mode) {
     
    262264
    263265        if (c_time) {
    264                 *c_time = interpret_long_date(rdata+0) - cli->serverzone;
     266                *c_time = convert_timespec_to_time_t(interpret_long_date(rdata+0)) - cli->serverzone;
    265267        }
    266268        if (a_time) {
    267                 *a_time = interpret_long_date(rdata+8) - cli->serverzone;
     269                *a_time = convert_timespec_to_time_t(interpret_long_date(rdata+8)) - cli->serverzone;
    268270        }
    269271        if (m_time) {
    270                 *m_time = interpret_long_date(rdata+16) - cli->serverzone;
     272                *m_time = convert_timespec_to_time_t(interpret_long_date(rdata+16)) - cli->serverzone;
    271273        }
    272274        if (w_time) {
    273                 *w_time = interpret_long_date(rdata+24) - cli->serverzone;
     275                *w_time = convert_timespec_to_time_t(interpret_long_date(rdata+24)) - cli->serverzone;
    274276        }
    275277        if (mode) {
     
    291293return a connection to a server
    292294*******************************************************/
    293 int _System smbwrp_connect(smbwrp_server * srv, cli_state * c)
     295int _System smbwrp_connect(smbwrp_server * srv, struct cli_state * cli)
    294296{
    295297        char * server = srv->server_name;
     
    300302        fstring group;
    301303        struct in_addr ip;
    302         int rc;
    303 
    304         zero_ip(&ip);
    305         ZERO_STRUCTP(c);
     304        NTSTATUS rc;
     305        struct cli_state * c;
     306
     307        zero_ip(&ip);
    306308
    307309        DEBUG(1,("Connecting to \\\\%s:%s@%s:%s\\%s. Master %s:%d\n", srv->username, srv->password, workgroup, server, share, srv->master, srv->ifmastergroup));
     
    343345
    344346        /* have to open a new connection */
    345         if (!cli_initialise(c))
     347        if (!(c=cli_initialise()))
    346348        {
    347349                return 2;
     
    370372        DEBUG(4,(" session setuping for <%s>/<%s> %d in <%s> %08x %08x %08x\n", srv->username, srv->password, strlen(srv->password), workgroup, c->protocol, c->sec_mode, c->capabilities));
    371373
    372         rc = cli_session_setup(c, srv->username,
     374        if (!NT_STATUS_IS_OK(cli_session_setup(c, srv->username,
    373375                               srv->password, strlen(srv->password),
    374376                               srv->password, strlen(srv->password),
    375                                workgroup);
    376         if (!rc)
    377         {
     377                               workgroup))) {
    378378                DEBUG(4,("%s/%s login failed\n", srv->username, srv->password));
    379379                /* try an anonymous login if it failed */
    380                 rc = cli_session_setup(c, "", "", 1,"", 0, workgroup);
    381                 if (!rc)
    382                 {
     380                if (!NT_STATUS_IS_OK(cli_session_setup(c, "", "", 1,"", 0, workgroup))) {
    383381                        DEBUG(4,("Anonymous login failed"));
    384382                        cli_shutdown(c);
     
    396394
    397395        DEBUG(4,(" tconx ok. cli caps %08x\n", c->capabilities));
     396
     397        // copy back cli_state
     398        memcpy( cli, c, sizeof( struct cli_state));
    398399
    399400//      srv->dev = (dev_t)(str_checksum(server) ^ str_checksum(share));
     
    441442                time_t t;
    442443                file->mtime = time(NULL);
    443                 t = TimeDiff(file->mtime);
     444                t = get_time_zone(file->mtime);
    444445                DEBUG(4,("cli_open mtime %lu %lu\n", file->mtime, t));
    445446                file->mtime -= t;
     
    520521        if (file->openattr || file->mtime)
    521522        {
    522                 DEBUG(4,("Set attr on close %s %08x %d %d\n", file->fname, file->openattr, file->mtime, file->mtime + TimeDiff(file->mtime)));
    523                 if (!cli_setatr(cli, file->fname, file->openattr, file->mtime + TimeDiff(file->mtime)))
     523                DEBUG(4,("Set attr on close %s %08x %d %d\n", file->fname, file->openattr, file->mtime, file->mtime + get_time_zone(file->mtime)));
     524                if (!cli_setatr(cli, file->fname, file->openattr, file->mtime + get_time_zone(file->mtime)))
    524525                {
    525526                        DEBUG(4,("Set attr on close failed %d\n", os2cli_errno(cli)));
     
    635636        }
    636637
    637 DEBUG(4,("Setting on <%s> attr %04x, time %lu/%lu\n", finfo->fname, finfo->attr, finfo->mtime, finfo->mtime + TimeDiff(finfo->mtime)));
    638         if (!cli_setatr(cli, finfo->fname, finfo->attr, finfo->mtime + (finfo->mtime == 0 ? 0 : TimeDiff(finfo->mtime)))
     638DEBUG(4,("Setting on <%s> attr %04x, time %lu/%lu\n", finfo->fname, finfo->attr, finfo->mtime, finfo->mtime + get_time_zone(finfo->mtime)));
     639        if (!cli_setatr(cli, finfo->fname, finfo->attr, finfo->mtime + (finfo->mtime == 0 ? 0 : get_time_zone(finfo->mtime)))
    639640                && !cli_setatr(cli, finfo->fname, finfo->attr, 0))
    640641        {
     
    737738                finfo->attr &= 0x7F;
    738739//DEBUG(2,("gotattr %08x <%s>\n", finfo->attr, finfo->fname));
    739 //              finfo->ctime -= TimeDiff(finfo->ctime);
    740 //              finfo->atime -= TimeDiff(finfo->atime);
    741 //              finfo->mtime -= TimeDiff(finfo->mtime);
     740//              finfo->ctime -= get_time_zone(finfo->ctime);
     741//              finfo->atime -= get_time_zone(finfo->atime);
     742//              finfo->mtime -= get_time_zone(finfo->mtime);
    742743                return 0;
    743744        }
     
    761762        {
    762763//DEBUG(2,("gotattr1 %08x <%s>\n", finfo->attr, finfo->fname));
    763                 finfo->mtime -= TimeDiff(finfo->mtime);
     764                finfo->mtime -= get_time_zone(finfo->mtime);
    764765                finfo->atime = finfo->mtime;
    765766                finfo->ctime = finfo->mtime;
     
    794795                else
    795796                {
    796                         finfo->ctime -= TimeDiff(finfo->ctime);
    797                         finfo->atime -= TimeDiff(finfo->atime);
    798                         finfo->mtime -= TimeDiff(finfo->mtime);
     797                        finfo->ctime -= get_time_zone(finfo->ctime);
     798                        finfo->atime -= get_time_zone(finfo->atime);
     799                        finfo->mtime -= get_time_zone(finfo->mtime);
    799800                }
    800801        }
    801802        else
    802803        {
    803 //              finfo->ctime -= TimeDiff(finfo->ctime);
    804 //              finfo->atime -= TimeDiff(finfo->atime);
    805 //              finfo->mtime -= TimeDiff(finfo->mtime);
     804//              finfo->ctime -= get_time_zone(finfo->ctime);
     805//              finfo->atime -= get_time_zone(finfo->atime);
     806//              finfo->mtime -= get_time_zone(finfo->mtime);
    806807        }
    807808
     
    814815add a entry to a directory listing
    815816*******************************************************/
    816 static void smbwrp_dir_add(smbwrp_fileinfo *finfo, const char *mask, void *state)
     817static void smbwrp_dir_add(const char* mnt, smbwrp_fileinfo *finfo, const char *mask, void *state)
    817818{
    818819        if (state && finfo)
     
    827828        }
    828829}
    829 
     830#if 0
    830831static void smbwrp_dir_add_old(struct file_info *finfo, const char *mask, void *state)
    831832{
     
    839840                        st->finfo.easize = -1;
    840841                        st->finfo.attr = finfo->mode;
    841                         st->finfo.ctime = finfo->ctime - TimeDiff(finfo->ctime);
    842                         st->finfo.mtime = finfo->mtime - TimeDiff(finfo->mtime);
    843                         st->finfo.atime = finfo->atime - TimeDiff(finfo->atime);
     842                        st->finfo.ctime = finfo->ctime_ts.tv_sec - get_time_zone(finfo->ctime_ts.tv_sec);
     843                        st->finfo.mtime = finfo->mtime_ts.tv_sec - get_time_zone(finfo->mtime_ts.tv_sec);
     844                        st->finfo.atime = finfo->atime_ts.tv_sec - get_time_zone(finfo->atime_ts.tv_sec);
    844845                        st->add_dir_entry(state);
    845846                }
    846847        }
    847848}
    848 
    849 static void smbwrp_special_add(char * name, void * state)
     849#endif
     850
     851static void smbwrp_special_add(const char * name, void * state)
    850852{
    851853        smbwrp_fileinfo finfo = {0};
     
    861863        finfo.attr = aRONLY | aDIR;
    862864
    863         smbwrp_dir_add(&finfo, NULL, state);
     865        smbwrp_dir_add("", &finfo, NULL, state);
    864866}
    865867
     
    873875
    874876        strncpy(finfo.fname, job->name, sizeof(finfo.fname) - 1);
    875         finfo.mtime = job->t - TimeDiff(job->t);
     877        finfo.mtime = job->t - get_time_zone(job->t);
    876878        finfo.atime = finfo.mtime;
    877879        finfo.ctime = finfo.mtime;
     
    879881        finfo.size = job->size;
    880882
    881         smbwrp_dir_add(&finfo, NULL, state);
     883        smbwrp_dir_add("", &finfo, NULL, state);
    882884}
    883885
     
    894896        finfo.attr = aRONLY | aDIR;     
    895897
    896         smbwrp_dir_add(&finfo, NULL, state);
    897 }
    898 
     898        smbwrp_dir_add("", &finfo, NULL, state);
     899}
    899900
    900901/****************************************************************************
     
    904905 by NT and 2 is used by OS/2
    905906****************************************************************************/
    906 
    907 static int interpret_long_filename(struct cli_state *cli,
    908                                    int level,char *p,smbwrp_fileinfo *finfo)
     907// YD from libsmb\clilist.c
     908static size_t _os2_interpret_long_filename(struct cli_state *cli,
     909                                   int level,char *p, smbwrp_fileinfo *finfo,
     910                                        uint32 *p_resume_key, DATA_BLOB *p_last_name_raw, uint32 *p_last_name_raw_len)
    909911{
    910912        extern file_info def_finfo;
     
    917919//      memcpy(finfo,&def_finfo,sizeof(*finfo));
    918920        finfo->attr = def_finfo.mode;
    919         finfo->mtime = def_finfo.mtime;
    920         finfo->atime = def_finfo.atime;
    921         finfo->ctime = def_finfo.ctime;
     921        finfo->mtime = def_finfo.mtime_ts.tv_sec;
     922        finfo->atime = def_finfo.atime_ts.tv_sec;
     923        finfo->ctime = def_finfo.ctime_ts.tv_sec;
    922924        strncpy(finfo->fname, def_finfo.name, sizeof(finfo->fname) - 1);
    923925
     
    926928                        /* these dates are converted to GMT by
    927929                           make_unix_date */
    928                         finfo->ctime = make_unix_date2(p+4);
    929                         finfo->atime = make_unix_date2(p+8);
    930                         finfo->mtime = make_unix_date2(p+12);
     930                        finfo->ctime = cli_make_unix_date2(cli, p+4);
     931                        finfo->atime = cli_make_unix_date2(cli, p+8);
     932                        finfo->mtime = cli_make_unix_date2(cli, p+12);
    931933                        finfo->size = IVAL(p,16);
    932934                        finfo->attr = CVAL(p,24);
     
    948950                        /* these dates are converted to GMT by
    949951                           make_unix_date */
    950                         finfo->ctime = make_unix_date2(p+4);
    951                         finfo->atime = make_unix_date2(p+8);
    952                         finfo->mtime = make_unix_date2(p+12);
     952                        finfo->ctime = cli_make_unix_date2(cli, p+4);
     953                        finfo->atime = cli_make_unix_date2(cli, p+8);
     954                        finfo->mtime = cli_make_unix_date2(cli, p+12);
    953955                        finfo->size = IVAL(p,16);
    954956                        finfo->attr = CVAL(p,24);
     
    967969                        size_t namelen, slen;
    968970                        p += 4; /* next entry offset */
     971#if 0
     972                        if (p_resume_key) {
     973                                *p_resume_key = IVAL(p,0);
     974                        }
     975#endif
    969976                        p += 4; /* fileindex */
    970977                               
    971                         /* these dates appear to arrive in a
    972                            weird way. It seems to be localtime
    973                            plus the serverzone given in the
    974                            initial connect. This is GMT when
    975                            DST is not in effect and one hour
    976                            from GMT otherwise. Can this really
    977                            be right??
    978                            
    979                            I suppose this could be called
    980                            kludge-GMT. Is is the GMT you get
    981                            by using the current DST setting on
    982                            a different localtime. It will be
    983                            cheap to calculate, I suppose, as
    984                            no DST tables will be needed */
    985                        
    986                         finfo->ctime = interpret_long_date(p);
     978                        /* Offset zero is "create time", not "change time". */
    987979                        p += 8;
    988                         finfo->atime = interpret_long_date(p);
     980                        finfo->atime = interpret_long_date(p).tv_sec;
    989981                        p += 8;
    990                         finfo->mtime = interpret_long_date(p);
     982                        finfo->mtime = interpret_long_date(p).tv_sec;
    991983                        p += 8;
     984                        finfo->ctime = interpret_long_date(p).tv_sec;
    992985                        p += 8;
    993986                        finfo->size = IVAL2_TO_SMB_BIG_UINT(p,0);
     
    998991                        namelen = IVAL(p,0);
    999992                        p += 4;
    1000                         finfo->easize = IVAL(p,0);
    1001993                        p += 4; /* EA size */
    1002994                        slen = SVAL(p, 0);
    1003995                        p += 2;
     996#if 0                   
     997                        {
     998                                /* stupid NT bugs. grr */
     999                                int flags = 0;
     1000                                if (p[1] == 0 && namelen > 1) flags |= STR_UNICODE;
     1001                                clistr_pull(cli, finfo->short_name, p,
     1002                                            sizeof(finfo->short_name),
     1003                                            slen, flags);
     1004                        }
     1005#endif
    10041006                        p += 24; /* short name? */       
    10051007                        clistr_pull(cli, finfo->fname, p,
    10061008                                    sizeof(finfo->fname),
    10071009                                    namelen, 0);
    1008                         return SVAL(base, 0);
     1010
     1011                        /* To be robust in the face of unicode conversion failures
     1012                           we need to copy the raw bytes of the last name seen here.
     1013                           Namelen doesn't include the terminating unicode null, so
     1014                           copy it here. */
     1015#if 0
     1016                        if (p_last_name_raw && p_last_name_raw_len) {
     1017                                if (namelen + 2 > p_last_name_raw->length) {
     1018                                        memset(p_last_name_raw->data, '\0', sizeof(p_last_name_raw->length));
     1019                                        *p_last_name_raw_len = 0;
     1020                                } else {
     1021                                        memcpy(p_last_name_raw->data, p, namelen);
     1022                                        SSVAL(p_last_name_raw->data, namelen, 0);
     1023                                        *p_last_name_raw_len = namelen + 2;
     1024                                }
     1025                        }
     1026#endif
     1027                        return (size_t)IVAL(base, 0);
    10091028                }
    10101029        }
    10111030       
    10121031        DEBUG(1,("Unknown long filename format %d\n",level));
    1013         return(SVAL(p,0));
     1032        return (size_t)IVAL(base,0);
    10141033}
    10151034
     
    10201039
    10211040static int list_files(struct cli_state *cli, const char *Mask, uint16 attribute,
    1022                  void (*fn)(smbwrp_fileinfo *, const char *, void *), void *state)
    1023 {
     1041                 void (*fn)(const char*, smbwrp_fileinfo *, const char *, void *), void *state)
     1042{
     1043#if 1
     1044        int max_matches = 1366; /* Match W2k - was 512. */
     1045#else
    10241046        int max_matches = 512;
     1047#endif
    10251048        int info_level;
    10261049        char *p, *p2;
     
    10341057        int ff_searchcount=0;
    10351058        int ff_eos=0;
    1036         int ff_lastname=0;
     1059        //int ff_lastname=0;
    10371060        int ff_dir_handle=0;
    10381061        int loop_count = 0;
     
    10411064        uint16 setup;
    10421065        pstring param;
     1066        const char *mnt;
     1067        uint32 resume_key = 0;
     1068        uint32 last_name_raw_len = 0;
     1069        DATA_BLOB last_name_raw = data_blob(NULL, 2*sizeof(pstring));
    10431070
    10441071        /* NT uses 260, OS/2 uses 2. Both accept 1. */
     
    10471074        DEBUG(4,("list_files level %d. mask <%s>\n", info_level, mask));
    10481075
    1049         pstrcpy(mask,Mask);
    1050        
     1076        /* when getting a directory listing from a 2k dfs root share,
     1077           we have to include the full path (\server\share\mask) here */
     1078           
     1079        if ( cli->dfsroot )
     1080                pstr_sprintf( mask, "\\%s\\%s\\%s", cli->desthost, cli->share, Mask );
     1081        else
     1082                pstrcpy(mask,Mask);
     1083
    10511084        while (ff_eos == 0) {
    10521085                loop_count++;
     
    10601093                        SSVAL(param,0,attribute); /* attribute */
    10611094                        SSVAL(param,2,max_matches); /* max count */
    1062                         SSVAL(param,4,4+2);     /* resume required + close on end */
     1095                        //SSVAL(param,4,4+2);   /* resume required + close on end */
     1096                        SSVAL(param,4,(FLAG_TRANS2_FIND_REQUIRE_RESUME|FLAG_TRANS2_FIND_CLOSE_IF_END)); /* resume required + close on end */
    10631097                        SSVAL(param,6,info_level);
    10641098                        SIVAL(param,8,0);
     
    10701104                        SSVAL(param,0,ff_dir_handle);
    10711105                        SSVAL(param,2,max_matches); /* max count */
     1106                        //SIVAL(param,6,0); /* ff_resume_key */
    10721107                        SSVAL(param,4,info_level);
    1073                         SIVAL(param,6,0); /* ff_resume_key */
    1074                         SSVAL(param,10,8+4+2);  /* continue + resume required + close on end */
     1108                        /* For W2K servers serving out FAT filesystems we *must* set the
     1109                           resume key. If it's not FAT then it's returned as zero. */
     1110                        SIVAL(param,6,resume_key); /* ff_resume_key */
     1111                        /* NB. *DON'T* use continue here. If you do it seems that W2K and bretheren
     1112                           can miss filenames. Use last filename continue instead. JRA */
     1113                        SSVAL(param,10,(FLAG_TRANS2_FIND_REQUIRE_RESUME|FLAG_TRANS2_FIND_CLOSE_IF_END));        /* resume required + close on end */
     1114                        //SSVAL(param,10,8+4+2);        /* continue + resume required + close on end */
    10751115                        p = param+12;
    1076                         p += clistr_push(cli, param+12, mask, sizeof(param)-12,
    1077                                          STR_TERMINATE);
     1116                        //p += clistr_push(cli, param+12, mask, sizeof(param)-12,
     1117                        //               STR_TERMINATE);
     1118                        if (last_name_raw_len && (last_name_raw_len < (sizeof(param)-12))) {
     1119                                memcpy(p, last_name_raw.data, last_name_raw_len);
     1120                                p += last_name_raw_len;
     1121                        } else {
     1122                                p += clistr_push(cli, param+12, mask, sizeof(param)-12, STR_TERMINATE);
     1123                        }
    10781124                }
    10791125
     
    11031149                        uint8 eclass;
    11041150                        uint32 ecode;
     1151
     1152                        SAFE_FREE(rdata);
     1153                        SAFE_FREE(rparam);
     1154
    11051155                        cli_dos_error(cli, &eclass, &ecode);
    11061156                        if (eclass != ERRSRV || ecode != ERRerror)
     
    11201170                                continue;
    11211171                        }
     1172                        SAFE_FREE(rdata);
     1173                        SAFE_FREE(rparam);
    11221174                        break;
    11231175                }
     
    11321184                        ff_searchcount = SVAL(p,2);
    11331185                        ff_eos = SVAL(p,4);
    1134                         ff_lastname = SVAL(p,8);
     1186                        //ff_lastname = SVAL(p,8);
    11351187                } else {
    11361188                        ff_searchcount = SVAL(p,0);
    11371189                        ff_eos = SVAL(p,2);
    1138                         ff_lastname = SVAL(p,6);
    1139                 }
    1140                 DEBUG(4,("list_files %d %d %d %d\n", ff_searchcount, ff_eos, ff_lastname, First));
    1141 
    1142                 if (ff_searchcount == 0)
     1190                        //ff_lastname = SVAL(p,6);
     1191                }
     1192                DEBUG(4,("list_files %d %d %d %d\n", ff_searchcount, ff_eos, "(ff_lastname)", First));
     1193
     1194                if (ff_searchcount == 0) {
     1195                        SAFE_FREE(rdata);
     1196                        SAFE_FREE(rparam);
    11431197                        break;
     1198                }
    11441199
    11451200                /* point to the data bytes */
     
    11491204                finfo.easize = -1;
    11501205                /* we might need the lastname for continuations */
    1151                 if (ff_lastname > 0) {
    1152                         switch(info_level) {
    1153                                 case 260:
    1154                                         clistr_pull(cli, mask, p+ff_lastname,
    1155                                                     sizeof(mask),
    1156                                                     data_len-ff_lastname,
    1157                                                     STR_TERMINATE);
    1158                                         break;
    1159                                 case 1:
    1160                                 case 2:
    1161                                         clistr_pull(cli, mask, p+ff_lastname+1,
    1162                                                     sizeof(mask),
    1163                                                     -1,
    1164                                                     STR_TERMINATE);
    1165                                         break;
    1166                                 }
     1206                for (p2=p,i=0;i<ff_searchcount;i++) {
     1207                        if ((info_level == 260) && (i == ff_searchcount-1)) {
     1208                                /* Last entry - fixup the last offset length. */
     1209                                SIVAL(p2,0,PTR_DIFF((rdata + data_len),p2));
     1210                        }
     1211                        p2 += _os2_interpret_long_filename(cli,info_level,p2,&finfo,
     1212                                                        &resume_key,&last_name_raw,&last_name_raw_len);
     1213
     1214                        if (!First && *mask && strcsequal(finfo.fname, mask)) {
     1215                                DEBUG(0,("Error: Looping in FIND_NEXT as name %s has already been seen?\n",
     1216                                        finfo.fname));
     1217                                ff_eos = 1;
     1218                                break;
     1219                        }
     1220                }
     1221
     1222                if (ff_searchcount > 0) {
     1223                        pstrcpy(mask, finfo.fname);
    11671224                } else {
    11681225                        pstrcpy(mask,"");
    11691226                }
    1170  
     1227
     1228                /* grab the data for later use */
    11711229                /* and add them to the dirlist pool */
    1172                 tdl = Realloc(dirlist,dirlist_len + data_len);
    1173 
    1174                 if (!tdl) {
     1230                dirlist = (char *)SMB_REALLOC(dirlist,dirlist_len + data_len);
     1231
     1232                if (!dirlist) {
    11751233                        DEBUG(0,("cli_list_new: Failed to expand dirlist\n"));
     1234                        SAFE_FREE(rdata);
     1235                        SAFE_FREE(rparam);
    11761236                        break;
    1177                 } else {
    1178                         dirlist = tdl;
    1179                 }
    1180 
    1181                 /* put in a length for the last entry, to ensure we can chain entries
    1182                    into the next packet */
    1183                 for (p2=p,i=0;i<(ff_searchcount-1);i++)
    1184                         p2 += interpret_long_filename(cli,info_level,p2,NULL);
    1185                 SSVAL(p2,0,data_len - PTR_DIFF(p2,p));
    1186 
    1187                 /* grab the data for later use */
     1237                }
     1238
    11881239                memcpy(dirlist+dirlist_len,p,data_len);
    11891240                dirlist_len += data_len;
     
    12031254        }
    12041255
    1205         DEBUG(3,("total received %d entries\n", total_received));
    1206         for (p=dirlist,i=0;i<total_received;i++) {
    1207                 p += interpret_long_filename(cli,info_level,p,&finfo);
    1208                 fn(&finfo, Mask, state);
    1209         }
    1210 
    1211         /* free up the dirlist buffer */
     1256        mnt = cli_cm_get_mntpoint( cli );
     1257
     1258        /* see if the server disconnected or the connection otherwise failed */
     1259        if (cli_is_error(cli)) {
     1260                total_received = -1;
     1261        } else {
     1262                /* no connection problem.  let user function add each entry */
     1263                for (p=dirlist,i=0;i<total_received;i++) {
     1264                        p += _os2_interpret_long_filename(cli, info_level, p,
     1265                                                     &finfo,NULL,NULL,NULL);
     1266                        fn( mnt,&finfo, Mask, state );
     1267                }
     1268        }
     1269
     1270        /* free up the dirlist buffer and last name raw blob */
    12121271        SAFE_FREE(dirlist);
     1272        data_blob_free(&last_name_raw);
    12131273        return(total_received);
    12141274}
Note: See TracChangeset for help on using the changeset viewer.