Changeset 533


Ignore:
Timestamp:
Jan 26, 2011, 3:31:18 PM (15 years ago)
Author:
Silvan Scherrer
Message:

Samba Client 2.1: degug changes, attemp to fix the trap

Location:
trunk/client/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/src/debug.c

    r508 r533  
    3232
    3333int debuglevel = 9; // we set it to 9, so we get all messages
    34 char logfile[_MAX_PATH +1]  = {0};
    35 char debugfile[_MAX_PATH +1] = {0};
     34char logfile[_MAX_PATH +1];
     35char debugfile[_MAX_PATH +1];
    3636char logfilename[] = "log.ndpsmb";
    37 BOOL do_logging = FALSE;
    38 BOOL firstLogLine = TRUE;
     37BOOL do_logging;
     38BOOL firstLogLine;
     39HMTX logMutex;
     40char nameMutex[] = "\\SEM32\\NDPSMB";
    3941
    4042int debuglvl(int level)
     
    4850}
    4951
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
     100
     101
    50102void debuglocal(int level, const char * fmt, ...)
    51103{
    52104        FILE *f=NULL;
    53         struct stat filestat;
    54105
    55         // do we have to log at all (not needed atm)
    56 /*      if (!debuglvl(level))
     106        // do we have to log at all
     107)
    57108        {
    58109                return;
    59         }*/
     110        }
    60111
    61         // if the file ndpsmb.dbg is around we write a logfile
    62         if (!debugfile[0])
     112        // if the
     113        if ()
    63114        {
    64            strncpy(debugfile, getenv("ETC"), 2);
    65            strncat(debugfile, "\\", sizeof(debugfile) - strlen(debugfile) -1);
    66            strncat(debugfile, "ndpsmb.dbg", sizeof(debugfile) - strlen(debugfile) -1);
    67         } /* endif */
    68        
    69         if (stat(debugfile, &filestat) !=0)
    70            return;
    71 
    72         //we create the logfile variable only once
    73         if (!logfile[0])
    74         {
    75                 char *env = getenv("LOGFILES");
    76                 if (env != NULL)
    77                 {
    78                    strncpy(logfile, env, sizeof(logfile) -1);
    79                    strncat(logfile, "\\", sizeof(logfile) - strlen(logfile) -1);
    80                    strncat(logfile, logfilename, sizeof(logfile) - strlen(logfile) -1); 
    81                 }
    82                 else
    83                 {
    84                    strncpy(logfile, logfilename, sizeof(logfile) -1);
    85                 }
    86                 // set the samba logging stuff
    87                 do_logging = TRUE;
    88         } /* endif */
     115           DosRequestMutexSem(logMutex, (ULONG) SEM_INDEFINITE_WAIT);
     116        }
    89117
    90118        do
     
    121149                if (logfile)
    122150                {
    123                         fclose(f);
     151//                      fflush(f);
     152                        fclose(f);
    124153                }
    125154        }
    126155        while (0);
     156
     157
     158
     159
     160
     161
     162
     163
    127164}
  • trunk/client/src/ndpsmb.c

    r531 r533  
    150150                ifL = 1;
    151151        }
     152
    152153        debuglocal(9,"Working with %s bit fileio NDFS\n", ifL ? "64" : "32");
    153154        return NO_ERROR;
     
    157158int APIENTRY NdpPluginFree (void)
    158159{
     160
    159161        return NO_ERROR;
    160162}
     
    982984                                        {       
    983985                                            rc = (finfo.attr & FILE_DIRECTORY) !=0 ?
    984                                                 ERROR_PATH_NOT_FOUND :
    985                                                 ERROR_INVALID_PARAMETER;
     986                                                ERROR_:
     987                                                ERROR_;
    986988                                        }
    987989                                        else if (rc != ERROR_REM_NOT_LIST)
     
    12171219        NDDATABUF fdata = {0};
    12181220        smbwrp_fileinfo *finfo;
    1219         char    pBuffer[64*1024];
     1221        c;
    12201222
    12211223        if (!pfi || !pfi->pszName || !pFEAList)
     
    12391241        debuglocal(9,"NdpEAQuery in [%p] <%s> %08x %d\n", pConn, path, pGEAList, pGEAList ? pGEAList->cbList : 0);
    12401242
     1243
     1244
     1245
     1246
    12411247        do {
    1242                 rc = smbwrp_listea( pConn->cli, path, pBuffer, sizeof( pBuffer));
    1243                 pFEASrc = (FEALIST*) pBuffer;
     1248                rc = smbwrp_listea( pConn->cli, path, p);
     1249                pFEASrc = (FEALIST*) pBuffer;
    12441250                if (rc)
    12451251                {
     
    12681274                }
    12691275        } while (0);
     1276
    12701277        debuglocal(9,"NdpEAQuery <%s> %d %d %d\n", pfi->pszName, rc, pFEASrc->cbList, pFEAList->cbList);
    12711278
     
    13341341        NDDATABUF fdata = {0};
    13351342        smbwrp_fileinfo *finfo;
    1336         char    pBuffer[64*1024];
     1343        c;
    13371344        int easize;
    13381345
     
    13521359                return ERROR_EAS_NOT_SUPPORTED;
    13531360        }
     1361
    13541362        finfo = (smbwrp_fileinfo *)fdata.pData;
    13551363        easize = finfo->easize;
     
    13651373        debuglocal(9,"NdpEASize in [%p] <%s> \n", pConn, path);
    13661374
     1375
     1376
     1377
     1378
    13671379        do {
    1368                 rc = smbwrp_listea(pConn->cli, path, pBuffer, sizeof( pBuffer));
    1369                 pfealist = (FEALIST*)pBuffer;
     1380                rc = smbwrp_listea(pConn->cli, path, p);
     1381                pfealist = (FEALIST*)pBuffer;
    13701382                if (rc)
    13711383                {
     
    13901402                *pulEASize = pfealist->cbList;
    13911403        } while (0);
     1404
    13921405        debuglocal(9,"NdpEASize <%s> %d %d\n", pfi->pszName, *pulEASize, rc);
    13931406
     
    17401753        int rc = 0;
    17411754        unsigned long action;
    1742         char pBuffer[64*1024];
     1755        c;
    17431756        FEALIST * pFEASrc;
    17441757
     
    17531766
    17541767        debuglocal(9,"NdpFileEAQuery in [%p] <%s>/%d pGEAList=%08x\n", pConn, pConn->file.fname, pConn->file.fd, pGEAList);
     1768
     1769
     1770
     1771
     1772
    17551773        do {
    17561774                if (pConn->file.fd < 0)
     
    17591777                        break;
    17601778                }
    1761                 rc = smbwrp_flistea(pConn->cli, &pConn->file, pBuffer, sizeof( pBuffer));
    1762                 pFEASrc = (FEALIST *) pBuffer;
     1779                rc = smbwrp_flistea(pConn->cli, &pConn->file, p);
     1780                pFEASrc = (FEALIST *)Buffer;
    17631781                if (rc)
    17641782                {
     
    17871805                }
    17881806        } while (0);
     1807
    17891808        debuglocal(9,"NdpFileEAQuery out <%s>/%d pFEASrc->cbList=%d pFEAList->cbList=%d rc=%d\n", pConn->file.fname, pConn->file.fd, pFEASrc->cbList, pFEAList->cbList, rc);
    17901809
     
    18461865        char path[CCHMAXPATH+1] = {0};
    18471866        FEALIST * pFEAList;
    1848         char pBuffer[64*1024];
     1867        c;
    18491868
    18501869        if (!pulEASize)
     
    18581877
    18591878        debuglocal(9,"NdpFileEASize in [%p] <%s>/%d \n", pConn, pConn->file.fname, pConn->file.fd);
     1879
     1880
     1881
     1882
     1883
    18601884        do {
    18611885                if (pConn->file.fd < 0)
     
    18641888                        break;
    18651889                }
    1866                 rc = smbwrp_flistea(pConn->cli, &pConn->file, pBuffer, sizeof(pBuffer));
    1867                 pFEAList = (FEALIST*) pBuffer;
     1890                rc = smbwrp_flistea(pConn->cli, &pConn->file, p);
     1891                pFEAList = (FEALIST*)Buffer;
    18681892                if (rc)
    18691893                {
     
    18881912                *pulEASize = pFEAList->cbList;
    18891913        } while (0);
     1914
    18901915        debuglocal(9,"NdpFileEASize %d %d\n", *pulEASize, rc);
    18911916
  • trunk/client/src/smbwrp.c

    r528 r533  
    11131113        }
    11141114
    1115         ZERO_STRUCTP(finfo);
     1115/*      ZERO_STRUCTP(finfo); */
     1116        finfo->atime = 0;
     1117        finfo->ctime = 0;
     1118        finfo->mtime = 0;
     1119        *finfo->fname = '\0';
    11161120       
    11171121        switch (level) {
     
    11571161                        p += ret;
    11581162                        finfo->easize = -1;
    1159                         strncpy(finfo->fname, fname, sizeof(finfo->fname) -1);
     1163                        strnc(finfo->fname, fname, sizeof(finfo->fname) -1);
    11601164                        return PTR_DIFF(p, base);
    11611165
     
    11851189                        }
    11861190                        p += ret;
    1187                         strncpy(finfo->fname, fname, sizeof(finfo->fname) -1);
     1191                        strnc(finfo->fname, fname, sizeof(finfo->fname) -1);
    11881192                        return PTR_DIFF(p, base) + 1;
    11891193                       
     
    12461250                                return pdata_end - base;
    12471251                        }
    1248                         strncpy(finfo->fname, fname, sizeof(finfo->fname) -1);
     1252                        strnc(finfo->fname, fname, sizeof(finfo->fname) -1);
    12491253
    12501254                        /* To be robust in the face of unicode conversion failures
     
    14691473                                                        &resume_key, &last_name_raw);
    14701474
     1475
    14711476                        if (!finfo.fname) {
    14721477                                debuglocal(0,"Error: unable to parse name from info level %d\n",
     
    15371542                        p += _os2_interpret_long_filename(frame, cli, info_level, p, rdata_end,
    15381543                                                     &finfo,NULL,NULL);
     1544
    15391545                        if (!finfo.fname) {
    15401546                                debuglocal(0,"list_new: unable to parse name from info level %d\n",
Note: See TracChangeset for help on using the changeset viewer.