Ignore:
Timestamp:
May 12, 2009, 8:09:42 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Final fix for Ticket #88 (by diver)

Location:
branches/client-1.5/src
Files:
6 edited

Legend:

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

    r188 r189  
    2828#include <sys/types.h>
    2929#include <sys/time.h>
     30#include <sys/stat.h>
    3031
    31 // #include "smbwrp.h"
    32 
    33 int debuglevel = 0;
    34 char *logfile = NULL;
    35 
    36 
    37 void dbgfileinit(char *file, int loglevel)
    38 {
    39         logfile = file;
    40         debuglevel = loglevel;
    41 }
     32int debuglevel = 9; // we set it to 9, so we get all messages
     33char logfile[_MAX_PATH +1]  = {0};
     34char debugfile[_MAX_PATH +1] = {0};
     35char logfilename[] = "ndpsmb.log";
    4236
    4337int debuglvl(int level)
     
    4640}
    4741
    48 int debugheader(int level, char * file, char * func, int line)
    49 {
    50         int rc;
    51         if (!debuglvl(level))
    52         {
    53                 return 0;
    54         }
    55         rc = 1;
    56         do
    57         {
    58                 FILE * f;
    59                 struct timeval tv;
    60                 time_t t;
    61                 char buf[80] = {0};
    62                 if (logfile)
    63                 {
    64                         f = fopen(logfile, "a");
    65                         if (!f)
    66                         {
    67                                 rc = 0;
    68                                 break;
    69                         }
    70                 }
    71                 else
    72                 {
    73                         f = stdout;
    74                 }
    75                 gettimeofday(&tv, NULL);
    76                 t = time(NULL);
    77                 strftime(buf,sizeof(buf)-1,"%Y/%m/%d %H:%M:%S", localtime(&t));
    78                 fprintf(f, "%s.%d: %d %d: %s:%s(%d) :", buf, tv.tv_usec / 10000, level, (long)_gettid(), file, func, line);
    79                 if (logfile)
    80                 {
    81                         fclose(f);
    82                 }
    83         }
    84         while (0);
    85         return rc;
    86 }
    87 
    88 int debugmessage(char * fmt, ...)
    89 {
    90         do
    91         {
    92                 FILE * f;
    93                 va_list args;
    94                 if (logfile)
    95                 {
    96                         f = fopen(logfile, "a");
    97                         if (!f)
    98                         {
    99                                 break;
    100                         }
    101                 }
    102                 else
    103                 {
    104                         f = stdout;
    105                 }
    106                 va_start(args, fmt);
    107                 vfprintf(f, fmt, args);
    108                 va_end(args);
    109                 if (logfile)
    110                 {
    111                         fclose(f);
    112                 }
    113         }
    114         while (0);
    115         return 0;
    116 }
    117 
    11842void debuglocal(int level, const char * fmt, ...)
    11943{
     44        FILE *f=NULL;
     45        struct stat filestat;
     46
     47        // if the file ndpsmb.dbg is around we write a logfile
     48        if (!debugfile[0])
     49        {
     50           strncpy(debugfile, getenv("ETC"), 2);
     51           strncat(debugfile, "\\", sizeof(debugfile) - strlen(debugfile) -1);
     52           strncat(debugfile, "ndpsmb.dbg", sizeof(debugfile) - strlen(debugfile) -1);
     53        } /* endif */
     54       
     55        if (stat(debugfile, &filestat) !=0)
     56           return;
     57
     58        //we create the logfile variable only once
     59        if (!logfile[0])
     60        {
     61                char *env = getenv("LOGFILES");
     62                if (env != NULL)
     63                {
     64                   strncpy(logfile, env, sizeof(logfile) -1);
     65                   strncat(logfile, "\\", sizeof(logfile) - strlen(logfile) -1);
     66                   strncat(logfile, logfilename, sizeof(logfile) - strlen(logfile) -1); 
     67                }
     68                else
     69                {
     70                   strncpy(logfile, logfilename, sizeof(logfile) -1);
     71                }
     72        } /* endif */
    12073
    12174        if (!debuglvl(level))
     
    12578        do
    12679        {
    127                 FILE * f;
    12880                struct timeval tv;
    12981                char buf[80] = {0};
    13082                va_list args;
    131                 if (logfile)
     83                if (logfile[0])
    13284                {
    13385                        f = fopen(logfile, "a");
  • branches/client-1.5/src/ndpsmb.c

    r188 r189  
    3131#include "util.h"
    3232
     33#if 0
     34
    3335#ifndef DEBUG_PRINTF
    3436#define debug_printf( ...)
     
    3638
    3739#define log debug_printf
    38 
    39 #if 0
    40 void log(const char *fmt, ...)
    41 
    42         char *ndpsmb_debug = getenv("NDPSMB_DEBUG");
    43 
    44         if (ndpsmb_debug != NULL)
    45         {
    46                 FILE * logfile = NULL;
    47                 va_list args;
    48                 time_t t = time(NULL);
    49                 char timebuf[80] = {0};
    50                 strftime(timebuf,sizeof(timebuf)-1,"%Y/%m/%d %H:%M:%S", localtime(&t));
    51                 logfile = fopen("smblog","a");
    52                 if (logfile == NULL)
    53                 {
    54                         DosBeep(400,400);
    55                 }
    56                 else
    57                 {
    58                         fprintf(logfile, "%s: (%02d) ", timebuf, _gettid());
    59                         va_start(args, fmt);
    60                         vfprintf(logfile, fmt, args);   
    61                         va_end(args);
    62                         fclose(logfile);
    63                 }
    64         }
    65 }
    6640#endif
     41
     42#define debug_printf(...) debuglocal(9, __VA_ARGS__)
    6743
    6844// -------------------------------------------------------------
     
    266242                ifL = 1;
    267243        }
    268         log("Working with %s bit fileio NDFS\n", ifL ? "64" : "32");
     244        debuglocal(9,"Working with %s bit fileio NDFS\n", ifL ? "64" : "32");
    269245        return NO_ERROR;
    270246}
     
    560536        }
    561537#endif
    562 
    563         // init the debug part
    564         dbgfileinit(&pRes->logfile, pRes->loglevel);
    565538
    566539        return rc;
     
    744717        Resource *pRes = NULL;
    745718
    746         log("NdpMountResource in\n");
     719        debuglocal(9,"NdpMountResource in\n");
    747720
    748721        // init code
     
    778751                }
    779752        }
    780         log("NdpMountResource rc=%d\n", rc);
     753        debuglocal(9,"NdpMountResource rc=%d\n", rc);
    781754        return rc;
    782755}
     
    789762        MemSet(&pRes->srv, 0, sizeof(pRes->srv));
    790763        free(pRes);
    791         log("NdpFreeResource %d\n", NO_ERROR);
     764        debuglocal(9,"NdpFreeResource %d\n", NO_ERROR);
    792765        return NO_ERROR;
    793766}
     
    801774        int rc = ND_RSRC_DIFFERENT;
    802775
    803         log("NdpRsrcCompare in\n");
     776        debuglocal(9,"NdpRsrcCompare in\n");
    804777        if (ph->fsphStrICmp(pRes->srv.server_name, pRes2->srv.server_name) == 0
    805778                && ph->fsphStrICmp(pRes->srv.share_name, pRes2->srv.share_name) == 0
     
    811784        }
    812785
    813         log("NdpRsrcCompare %d\n", rc);
     786        debuglocal(9,"NdpRsrcCompare %d\n", rc);
    814787
    815788        return rc;
     
    819792{
    820793        // do nothing
    821         log("NdpRsrcUpdate %d\n", NO_ERROR);
     794        debuglocal(9,"NdpRsrcUpdate %d\n", NO_ERROR);
    822795        return NO_ERROR;
    823796}
     
    829802        char s[4096];
    830803
    831         log("NdpRsrcQueryInfo in\n");
     804        debuglocal(9,"NdpRsrcQueryInfo in\n");
    832805
    833806        switch (pRes->rootlevel)
     
    860833        }
    861834
    862         log("NdpRsrcQueryInfo %d\n", rc);
     835        debuglocal(9,"NdpRsrcQueryInfo %d\n", rc);
    863836
    864837        return rc;
     
    881854        FSALLOCATE fsa;
    882855
    883         log("NdpRsrcQueryFSAllocate %08x\n", pfsa);
     856        debuglocal(9,"NdpRsrcQueryFSAllocate %08x\n", pfsa);
    884857
    885858        if (!pfsa)
     
    892865        if (rc)
    893866        {
    894             log("NdpCreateConnection failed rc=%d\n", rc);     
     867            debuglocal(9,"NdpCreateConnection failed rc=%d\n", rc);     
    895868            pfsa->cSectorUnit = 1;
    896869            pfsa->cUnit = 123456;
     
    920893        smbwrp_disconnect( pRes, cli);
    921894
    922         log("NdpRsrcQueryFSAllocate %d/%d (cUnit = %d/cUnitAvail = %d/cbSector = %d)\n", rc, rc1, pfsa->cUnit, pfsa->cUnitAvail, pfsa->cbSector);
     895        debuglocal(9,"NdpRsrcQueryFSAllocate %d/%d (cUnit = %d/cUnitAvail = %d/cbSector = %d)\n", rc, rc1, pfsa->cUnit, pfsa->cUnitAvail, pfsa->cbSector);
    923896        return rc;
    924897}
     
    933906        Connection *pConn = NULL;
    934907
    935         log("NdpCreateConnection in\n");
     908        debuglocal(9,"NdpCreateConnection in\n");
    936909
    937910        pConn = malloc( sizeof(Connection));
     
    942915        if (rc)
    943916        {
    944                 log("NdpCreateConnection ERROR_NOT_ENOUGH_MEMORY %d\n", rc);
     917                debuglocal(9,"NdpCreateConnection ERROR_NOT_ENOUGH_MEMORY %d\n", rc);
    945918                return rc;
    946919        }
     
    949922        pConn->file.fd = -1;
    950923
    951         log("NdpCreateConnection send CONNECT\n");
     924        debuglocal(9,"NdpCreateConnection send CONNECT\n");
    952925        rc = smbwrp_connect( pRes, &pConn->cli);
    953926        if (rc)
     
    959932
    960933        *pconn = (HCONNECTION)pConn;
    961         log("NdpCreateConnection %d\n", rc);
     934        debuglocal(9,"NdpCreateConnection %d\n", rc);
    962935        return rc;
    963936}
     
    971944        int rc;
    972945
    973         log("NdpFreeConnection in\n");
     946        debuglocal(9,"NdpFreeConnection in\n");
    974947        if (pConn->file.fd >= 0)
    975948        {
     
    981954
    982955        free(pConn);
    983         log("NdpFreeConnection %d\n", NO_ERROR);
     956        debuglocal(9,"NdpFreeConnection %d\n", NO_ERROR);
    984957        return NO_ERROR;
    985958}
     
    1013986        int retry = 0;
    1014987
    1015                 log("NdpQueryPathInfo in <%s>, retry = %d\n", szPath, retry);
     988                debuglocal(9,"NdpQueryPathInfo in <%s>, retry = %d\n", szPath, retry);
    1016989       
    1017990                // is wildcard is specified, we suppose parent dir exist, so exit immediately
     
    1025998
    1026999                        rc = pathparser(pRes, pConn, szPath, path);
    1027                         log("NdpQueryPathInfo pathparser for <%s> rc=%d\n", path, rc);
     1000                        debuglocal(9,"NdpQueryPathInfo pathparser for <%s> rc=%d\n", path, rc);
    10281001                        switch (rc)
    10291002                        {
     
    10461019                        }
    10471020                        StrNCpy(finfo.fname, path, sizeof(finfo.fname) - 1);
    1048                         log("NdpQueryPathInfo smbwrp_getattr for <%s>\n", path);
     1021                        debuglocal(9,"NdpQueryPathInfo smbwrp_getattr for <%s>\n", path);
    10491022                        rc = smbwrp_getattr( &pRes->srv, pConn->cli, &finfo);
    10501023                        if (rc)
     
    10591032                                    // try file list again
    10601033                                    rc = smbwrp_getattr( &pRes->srv, pConn->cli, &finfo);
    1061                                     log("NdpQueryPathInfo remote connection lost, retry rc = %d\n", rc);
     1034                                    debuglocal(9,"NdpQueryPathInfo remote connection lost, retry rc = %d\n", rc);
    10621035                                }
    10631036                                switch (rc)
     
    10911064                                        if (rc)
    10921065                                        {       
    1093                                             log("NdpQueryPathInfo upper path in <%s>, retry = %d\n",  finfo.fname, retry);
     1066                                            debuglocal(9,"NdpQueryPathInfo upper path in <%s>, retry = %d\n",  finfo.fname, retry);
    10941067                                            rc = rc ? ERROR_PATH_NOT_FOUND : ERROR_INVALID_PARAMETER;
    10951068                                        }
     
    10971070                        }
    10981071                } while (0);
    1099                 log("NdpQueryPathInfo <%s> (%s) %d\n", szPath, path, rc);
     1072                debuglocal(9,"NdpQueryPathInfo <%s> (%s) %d\n", szPath, path, rc);
    11001073
    11011074        return rc;
     
    11731146                    // try file list again next loop
    11741147                    rc = smbwrp_filelist( &pRes->srv, pConn->cli, &state);
    1175                     log("NdpFindStart remote connection lost, retry rc = %d\n", rc);
    1176                 }
    1177 
    1178         log("NdpFindStart <%s> (%s) cnt %d %d\n", szPath, path, count, rc);
     1148                    debuglocal(9,"NdpFindStart remote connection lost, retry rc = %d\n", rc);
     1149                }
     1150
     1151        debuglocal(9,"NdpFindStart <%s> (%s) cnt %d %d\n", szPath, path, count, rc);
    11791152
    11801153        return rc;
     
    11831156int APIENTRY NdpDeletePathInfo (HRESOURCE resource, NDFILEINFOL *pfi)
    11841157{
    1185 //      log("NdpDeletePathInfo %d\n", 0);
     1158//      debuglocal(9,"NdpDeletePathInfo %d\n", 0);
    11861159        return NO_ERROR;
    11871160}
     
    11891162int APIENTRY NdpRefresh (HCONNECTION conn, char *path, int tree)
    11901163{
    1191         log("NdpRefresh <%s> %d\n", path, 0);
     1164        debuglocal(9,"NdpRefresh <%s> %d\n", path, 0);
    11921165        return NO_ERROR;
    11931166}
     
    12011174    // deallocated by NetDrive.
    12021175
    1203         log("NdpDicardresourceData %d\n", 0);
     1176        debuglocal(9,"NdpDicardresourceData %d\n", 0);
    12041177        return NO_ERROR;
    12051178}
     
    12301203                rc = smbwrp_setattr(pConn->cli, &finfo);
    12311204        } while (0);
    1232         log("NdpSetPathInfo <%s> (%s) %d\n", szPathName, path, rc);
     1205        debuglocal(9,"NdpSetPathInfo <%s> (%s) %d\n", szPathName, path, rc);
    12331206
    12341207        return rc;
     
    12461219        pfeadest = pFEAList->list;
    12471220        dsize = pFEAList->cbList;
    1248 //log("buildFEALIST in destsize %d srcsize %d pGEAList=%08x pGEAList->cbList=%d\n", dsize, ddone, size, pGEAList, pGEAList ? pGEAList->cbList : 0);
     1221//debuglocal(9,"buildFEALIST in destsize %d srcsize %d pGEAList=%08x pGEAList->cbList=%d\n", dsize, ddone, size, pGEAList, pGEAList ? pGEAList->cbList : 0);
    12491222        while (done < size)
    12501223        {
     
    12581231                        while (done < size)
    12591232                        {
    1260 //log("comp <%s> <%s>\n", name, pgea->szName);
     1233//debuglocal(9,"comp <%s> <%s>\n", name, pgea->szName);
    12611234                                if (!ph->fsphStrNCmp(name, pgea->szName, pgea->cbName))
    12621235                                {
     
    12821255                }
    12831256                done += sizeof(FEA) + pfea->cbName + 1 + pfea->cbValue;
    1284 //log("buuildfea <%s> insert=%d pfea->cbName=%d pfea->cbValue=%d srcdone=%d destdone=%d pfeadest=%08x pfea=%08x\n", name, insert, pfea->cbName, pfea->cbValue, done, ddone, pfeadest, pfea);
     1257//debuglocal(9,"buuildfea <%s> insert=%d pfea->cbName=%d pfea->cbValue=%d srcdone=%d destdone=%d pfeadest=%08x pfea=%08x\n", name, insert, pfea->cbName, pfea->cbValue, done, ddone, pfeadest, pfea);
    12851258                pfea = (FEA *)((char *)pFEASrc + done);
    12861259        }
     
    12901263                rc = ERROR_BUFFER_OVERFLOW;
    12911264        }
    1292         log("buildFEALIST rc=%d destsize=%d destdone=%d srcsize=%d pGEAList=%08x\n", rc, dsize, ddone, size, pGEAList);
     1265        debuglocal(9,"buildFEALIST rc=%d destsize=%d destdone=%d srcsize=%d pGEAList=%08x\n", rc, dsize, ddone, size, pGEAList);
    12931266        return rc;
    12941267}
     
    13181291        if (rc || !fdata.ulSize || !fdata.pData)
    13191292        {
    1320                 log("NdpEAQuery: ph->fsphGetFileInfoData = %d/%d %08x\n", rc, fdata.ulSize, fdata.pData);
     1293                debuglocal(9,"NdpEAQuery: ph->fsphGetFileInfoData = %d/%d %08x\n", rc, fdata.ulSize, fdata.pData);
    13211294                return ERROR_EAS_NOT_SUPPORTED;
    13221295        }
     
    13241297        path = finfo->fname;
    13251298
    1326         log("NdpEAQuery in <%s> %08x %d\n", path, pGEAList, pGEAList ? pGEAList->cbList : 0);
     1299        debuglocal(9,"NdpEAQuery in <%s> %08x %d\n", path, pGEAList, pGEAList ? pGEAList->cbList : 0);
    13271300
    13281301        do {
     
    13551328                }
    13561329        } while (0);
    1357         log("NdpEAQuery <%s> %d %d %d\n", pfi->pszName, rc, pFEASrc->cbList, pFEAList->cbList);
     1330        debuglocal(9,"NdpEAQuery <%s> %d %d %d\n", pfi->pszName, rc, pFEASrc->cbList, pFEAList->cbList);
    13581331
    13591332        return rc;
     
    13701343        smbwrp_fileinfo *finfo;
    13711344
    1372         log("NdpEASet in\n");
     1345        debuglocal(9,"NdpEASet in\n");
    13731346
    13741347        if (!pfi || !pfi->pszName || !pFEAList || pFEAList->cbList <= sizeof(long))
     
    13841357        if (rc || !fdata.ulSize || !fdata.pData)
    13851358        {
    1386                 log("NdpEASet: ph->fsphGetFileInfoData = %d/%d/%08x\n", rc, fdata.ulSize, fdata.pData);
     1359                debuglocal(9,"NdpEASet: ph->fsphGetFileInfoData = %d/%d/%08x\n", rc, fdata.ulSize, fdata.pData);
    13871360                return ERROR_EAS_NOT_SUPPORTED;
    13881361        }
     
    14061379                }
    14071380        } while (0);
    1408         log("NdpEASet %d\n", rc);
     1381        debuglocal(9,"NdpEASet %d\n", rc);
    14091382
    14101383        return rc;
     
    14361409        if (rc || !fdata.ulSize || !fdata.pData)
    14371410        {
    1438                 log("NdpEASize: ph->fsphGetFileInfoData = %d/%d/%08x\n", rc, fdata.ulSize, fdata.pData);
     1411                debuglocal(9,"NdpEASize: ph->fsphGetFileInfoData = %d/%d/%08x\n", rc, fdata.ulSize, fdata.pData);
    14391412                return ERROR_EAS_NOT_SUPPORTED;
    14401413        }
     
    14461419        {
    14471420                *pulEASize = easize;
    1448                 log("NdpEASize <%s> cached %d\n", path, easize);
     1421                debuglocal(9,"NdpEASize <%s> cached %d\n", path, easize);
    14491422                return NO_ERROR;
    14501423        }
    14511424
    1452         log("NdpEASize in <%s> \n", path);
     1425        debuglocal(9,"NdpEASize in <%s> \n", path);
    14531426
    14541427        do {
     
    14771450                *pulEASize = pfealist->cbList;
    14781451        } while (0);
    1479         log("NdpEASize <%s> %d %d\n", pfi->pszName, *pulEASize, rc);
     1452        debuglocal(9,"NdpEASize <%s> %d %d\n", pfi->pszName, *pulEASize, rc);
    14801453
    14811454        return rc;
     
    14901463        char path[CCHMAXPATH+1] = {0};
    14911464       
    1492         log("NdpSetCurrentDir in\n");
     1465        debuglocal(9,"NdpSetCurrentDir in\n");
    14931466
    14941467        do {
     
    15011474                rc = smbwrp_chdir(&pRes->srv, pConn->cli, path);
    15021475        } while (0);
    1503         log("NdpSetCurrentDir <%s> (%s) %d\n", szPath, path, rc);
     1476        debuglocal(9,"NdpSetCurrentDir <%s> (%s) %d\n", szPath, path, rc);
    15041477
    15051478        return rc;
     
    15081481int APIENTRY NdpCopy (HCONNECTION conn, NDFILEINFOL *pfiDst, char *szDst, NDFILEINFOL *pfiSrc, char *szSrc, ULONG ulOption)
    15091482{
    1510         log("NdpCopy <%s> -> <%s> %d\n", szSrc, szDst, ERROR_CANNOT_COPY);
     1483        debuglocal(9,"NdpCopy <%s> -> <%s> %d\n", szSrc, szDst, ERROR_CANNOT_COPY);
    15111484        return ERROR_CANNOT_COPY;
    15121485}
     
    15141487int APIENTRY NdpCopy2 (HCONNECTION conn, HRESOURCE resDst, NDFILEINFOL *pfiDst, char *szDst, NDFILEINFOL *pfiSrc, char *szSrc, ULONG ulOption)
    15151488{
    1516         log("NdpCopy2 <%s> -> <%s> %d\n", szSrc, szDst, ERROR_CANNOT_COPY);
     1489        debuglocal(9,"NdpCopy2 <%s> -> <%s> %d\n", szSrc, szDst, ERROR_CANNOT_COPY);
    15171490        return ERROR_CANNOT_COPY;
    15181491}
     
    15261499        char path[CCHMAXPATH+1] = {0};
    15271500
    1528         log("NdpForceDelete in\n");
     1501        debuglocal(9,"NdpForceDelete in\n");
    15291502
    15301503        do {
     
    15371510                rc = smbwrp_unlink(pConn->cli, path);
    15381511        } while (0);
    1539         log("NdpForceDelete <%s> (%s) %d\n", szFile, path, rc);
     1512        debuglocal(9,"NdpForceDelete <%s> (%s) %d\n", szFile, path, rc);
    15401513
    15411514        return rc;
     
    15501523        char path[CCHMAXPATH+1] = {0};
    15511524
    1552         log("NdpCreateDir in\n");
     1525        debuglocal(9,"NdpCreateDir in\n");
    15531526
    15541527        do {
     
    15611534                rc = smbwrp_mkdir(pConn->cli, path);
    15621535        } while (0);
    1563         log("NdpCreateDir <%s> (%s) %d\n", szDirName, path, rc);
     1536        debuglocal(9,"NdpCreateDir <%s> (%s) %d\n", szDirName, path, rc);
    15641537
    15651538        return rc;
     
    15741547        char path[CCHMAXPATH+1] = {0};
    15751548
    1576         log("NdpDeleteDir in\n");
     1549        debuglocal(9,"NdpDeleteDir in\n");
    15771550
    15781551        do {
     
    15851558                rc = smbwrp_rmdir(pConn->cli, path);
    15861559        } while (0);
    1587         log("NdpDeleteDir <%s> (%s) %d\n", szDir, path, rc);
     1560        debuglocal(9,"NdpDeleteDir <%s> (%s) %d\n", szDir, path, rc);
    15881561
    15891562        return rc;
     
    16001573        char * p = szDst;
    16011574
    1602         log("NdpMove in from <%s> to <%s>\n", szSrc, szDst);
     1575        debuglocal(9,"NdpMove in from <%s> to <%s>\n", szSrc, szDst);
    16031576
    16041577        do
     
    16241597                rc = smbwrp_rename(pConn->cli, src, p);
    16251598        } while (0);
    1626         log("NdpMove <%s> -> <%s> (%s) %d\n", szSrc, szDst, src, rc);
     1599        debuglocal(9,"NdpMove <%s> -> <%s> (%s) %d\n", szSrc, szDst, src, rc);
    16271600
    16281601        return rc;
     
    16311604int APIENTRY NdpMove2 (HCONNECTION conn, HRESOURCE resDst, NDFILEINFOL *pfiDst, char *szDst, NDFILEINFOL *pfiSrc, char *szSrc)
    16321605{
    1633         log("NdpMove2 <%s> -> <%s> %d\n", szSrc, szDst, ERROR_WRITE_PROTECT);
     1606        debuglocal(9,"NdpMove2 <%s> -> <%s> %d\n", szSrc, szDst, ERROR_WRITE_PROTECT);
    16341607        return ERROR_WRITE_PROTECT;
    16351608}
     
    16531626        char path[CCHMAXPATH+1] = {0};
    16541627
    1655         log("smbopen in %d\n", pConn->file.fd);
     1628        debuglocal(9,"smbopen in %d\n", pConn->file.fd);
    16561629
    16571630        do {
     
    16831656                rc = smbwrp_open(pConn->cli, &pConn->file);
    16841657        } while (0);
    1685         log("smbopen <%s> (%s) %08x %08x %08x %d. file = %d\n", szFileName, path, flags, ulOpenMode, ulAttribute, rc, pConn->file.fd);
     1658        debuglocal(9,"smbopen <%s> (%s) %08x %08x %08x %d. file = %d\n", szFileName, path, flags, ulOpenMode, ulAttribute, rc, pConn->file.fd);
    16861659        if (!rc && pFEAList)
    16871660        {
    16881661                int rc1 = NdpFileEASet((HCONNECTION)pConn, (NDFILEHANDLE)0, pFEAList);
    1689                 log("smbopen NdpFileEASet %d. pFEAList->cbList %d\n", rc1, pFEAList->cbList);
     1662                debuglocal(9,"smbopen NdpFileEASet %d. pFEAList->cbList %d\n", rc1, pFEAList->cbList);
    16901663        }
    16911664
     
    17301703        char path[CCHMAXPATH+1] = {0};
    17311704
    1732         log("NdpSetFileAttribute in\n");
     1705        debuglocal(9,"NdpSetFileAttribute in\n");
    17331706        do {
    17341707                rc = pathparser(pRes, pConn, szFileName, path);
     
    17431716                rc = smbwrp_setattr(pConn->cli, &finfo);
    17441717        } while (0);
    1745         log("NdpSetFileAttribute <%s> (%s) %04x %d\n", szFileName, path, usAttr, rc);
     1718        debuglocal(9,"NdpSetFileAttribute <%s> (%s) %04x %d\n", szFileName, path, usAttr, rc);
    17461719
    17471720        return rc;
     
    17501723int APIENTRY NdpFlush (HRESOURCE resource)
    17511724{
    1752         log("NdpFlush %d\n", ERROR_NOT_SUPPORTED);
     1725        debuglocal(9,"NdpFlush %d\n", ERROR_NOT_SUPPORTED);
    17531726        return ERROR_NOT_SUPPORTED;
    17541727}
     
    17561729int APIENTRY NdpIOCTL (int type, HRESOURCE resource, char *path, int function, void *in, ULONG insize, PULONG poutlen)
    17571730{
    1758     log("NdpIOCTL <%s> %d\n", path, function);
     1731    debuglocal(9,"NdpIOCTL <%s> %d\n", path, function);
    17591732
    17601733    if (in && insize > 4096)
     
    17931766                }
    17941767        } while (0);
    1795         log("NdpFileQueryInfo <%s> %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, rc);
     1768        debuglocal(9,"NdpFileQueryInfo <%s> %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, rc);
    17961769
    17971770        return rc;
     
    18161789        }
    18171790
    1818         log("NdpFileEAQuery in <%s>/%d pGEAList=%08x\n", pConn->file.fname, pConn->file.fd, pGEAList);
     1791        debuglocal(9,"NdpFileEAQuery in <%s>/%d pGEAList=%08x\n", pConn->file.fname, pConn->file.fd, pGEAList);
    18191792        do {
    18201793                if (pConn->file.fd < 0)
     
    18511824                }
    18521825        } while (0);
    1853         log("NdpFileEAQuery out <%s>/%d pFEASrc->cbList=%d pFEAList->cbList=%d rc=%d\n", pConn->file.fname, pConn->file.fd, pFEASrc->cbList, pFEAList->cbList, rc);
     1826        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);
    18541827
    18551828        return rc;
     
    18631836        unsigned long action;
    18641837
    1865         log("NdpFileEASet in\n");
     1838        debuglocal(9,"NdpFileEASet in\n");
    18661839
    18671840        if (!pFEAList || pFEAList->cbList <= sizeof(long))
     
    18971870
    18981871        } while (0);
    1899         log("NdpFileEASet %d\n", rc);
     1872        debuglocal(9,"NdpFileEASet %d\n", rc);
    19001873
    19011874        return rc;
     
    19211894        }
    19221895
    1923         log("NdpFileEASize in <%s>/%d \n", pConn->file.fname, pConn->file.fd);
     1896        debuglocal(9,"NdpFileEASize in <%s>/%d \n", pConn->file.fname, pConn->file.fd);
    19241897        do {
    19251898                if (pConn->file.fd < 0)
     
    19521925                *pulEASize = pFEAList->cbList;
    19531926        } while (0);
    1954         log("NdpFileEASize %d %d\n", *pulEASize, rc);
     1927        debuglocal(9,"NdpFileEASize %d %d\n", *pulEASize, rc);
    19551928
    19561929        return rc;
     
    19771950                debug_printf("NdpFileSetInfo mtime %d\n", pConn->file.mtime);
    19781951        } while (0);
    1979         log("NdpFileSetInfo <%s> %08x %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, attrFile, rc);
     1952        debuglocal(9,"NdpFileSetInfo <%s> %08x %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, attrFile, rc);
    19801953
    19811954        return NO_ERROR;
     
    19891962        unsigned long action;
    19901963
    1991         log("NdpFileSetFilePtrl in\n");
     1964        debuglocal(9,"NdpFileSetFilePtrl in\n");
    19921965
    19931966        do {
     
    20031976
    20041977        } while (0);
    2005         log("NdpFileSetFilePtrL <%s> %lld %lu %lld %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, llOffset, ulMethod, *pllActual, rc);
     1978        debuglocal(9,"NdpFileSetFilePtrL <%s> %lld %lu %lld %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, llOffset, ulMethod, *pllActual, rc);
    20061979
    20071980        return rc;
     
    20131986        int rc = NdpFileSetFilePtrL(conn, handle, lOffset, ulMethod, &llActual);
    20141987        *pulActual = llActual & 0xFFFFFFFF;
    2015         log("NdpFileSetFilePtr %ld %lu %ld %d\n", lOffset, ulMethod, *pulActual, rc);
     1988        debuglocal(9,"NdpFileSetFilePtr %ld %lu %ld %d\n", lOffset, ulMethod, *pulActual, rc);
    20161989        return rc;
    20171990}
     
    20241997        unsigned long action;
    20251998
    2026         log("NdpFileClose in %d <%s>\n", pConn->file.fd, pConn->file.fd < 0 ? "!null!" : pConn->file.fname);
     1999        debuglocal(9,"NdpFileClose in %d <%s>\n", pConn->file.fd, pConn->file.fd < 0 ? "!null!" : pConn->file.fname);
    20272000
    20282001        do {
     
    20362009
    20372010        } while (0);
    2038         log("NdpFileClose %d %d\n", pConn->file.fd, rc);
     2011        debuglocal(9,"NdpFileClose %d %d\n", pConn->file.fd, rc);
    20392012
    20402013        pConn->file.fd = -1;
     
    20442017int APIENTRY NdpFileCommit (HCONNECTION conn, NDFILEHANDLE handle)
    20452018{
    2046         log("NdpFileCommit %d\n", NO_ERROR);
     2019        debuglocal(9,"NdpFileCommit %d\n", NO_ERROR);
    20472020        return NO_ERROR;
    20482021}
     
    20522025{
    20532026        int rc = NdpFileNewSizeL(conn, handle, ulLen);
    2054         log("NdpFileNewSize %ld %d\n", ulLen, rc);
     2027        debuglocal(9,"NdpFileNewSize %ld %d\n", ulLen, rc);
    20552028        return rc;
    20562029}
     
    20632036        unsigned long action;
    20642037
    2065         log("NdpFileNewSizeL in\n");
     2038        debuglocal(9,"NdpFileNewSizeL in\n");
    20662039
    20672040        do {
     
    20752048
    20762049        } while (0);
    2077         log("NdpFileNewSizeL <%s> %lld %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, llLen, rc);
     2050        debuglocal(9,"NdpFileNewSizeL <%s> %lld %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, llLen, rc);
    20782051
    20792052        return rc;
     
    20892062        unsigned long action;
    20902063
    2091         log("NdpFileRead in\n");
     2064        debuglocal(9,"NdpFileRead in\n");
    20922065
    20932066        do {
     
    21022075
    21032076        } while (0);
    2104         log("NdpFileRead <%s> %lu %lu %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, ulRead, *pulActual, rc);
     2077        debuglocal(9,"NdpFileRead <%s> %lu %lu %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, ulRead, *pulActual, rc);
    21052078
    21062079        return rc;
     
    21162089        unsigned long action;
    21172090
    2118         log("NdpFileWrite in\n");
     2091        debuglocal(9,"NdpFileWrite in\n");
    21192092
    21202093        do {
     
    21272100
    21282101        } while (0);
    2129         log("NdpFileWrite <%s> %lu %lu %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, ulWrite, *pulActual, rc);
    2130 
    2131         return rc;
    2132 }
    2133 
    2134 
     2102        debuglocal(9,"NdpFileWrite <%s> %lu %lu %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, ulWrite, *pulActual, rc);
     2103
     2104        return rc;
     2105}
     2106
  • branches/client-1.5/src/rc/rc.ipf

    r9 r189  
    77.nameit symbol=ndcp text='NetDrive for OS/2 Control Panel'
    88.nameit symbol=mp text='mount point'
    9 .nameit symbol=ressmb text='SAMBA Resource Properties'
     9.nameit symbol=ressmb text='Samba Resource Properties'
    1010
    1111:title.NetDrive for OS/2 Control Panel Help
     
    4141:pd.0 if 'master' is the name of master server, 1 if 'master' is the name of master workgroup.
    4242
    43 :pt.Memlen
    44 :pd.The size of shared memory buffer allocated for every NDFS connection in size of 64k blocks.
    45 
    46 :pt.Logfile
    47 :pd.File to log records from smbcd.exe. Used only if smbcd.exe is run by ndpsmb.dll plugin, not manually.
    48 
    49 :pt.Loglevel
    50 :pd.Level of logging (0-9) for smbcd.exe. Used only if smbcd.exe is run by ndpsmb.dll plugin, not manually.
    51 
    5243:pt.EA Support
    5344:pd.Switches on/off EA support.
    5445
    5546:eparml.
     47:p.
     48.br
     49.br
     50:hp2.To produce a logfile add an empty file called ndpsmb.dbg into the root drive. :ehp2.
     51.br
     52.br
     53The logfile is placed to your LOGFILES env path, if available. If the LOGFILES env is missing
     54the logfile is placed into the netdrive directory. The logfile is called ndpsmb.log.
    5655.******************************************************
    5756:euserdoc.
  • branches/client-1.5/src/rc/rc.rc

    r116 r189  
    150150RCDATA (DLG_ID + 12)
    151151{
    152     0
     152    1
    153153}
    154154
  • branches/client-1.5/src/smbwrp.c

    r187 r189  
    2323#include "smbwrp.h"
    2424
    25 #ifndef DEBUG_PRINTF
    26 #define debug_printf( ...)
    27 #endif
    2825
    2926static int
     
    858855                return EINVAL;
    859856        }
    860         debug_printf( "smbwrp_getattr\n");
    861857        debuglocal(4,"getattr %d %d <%s>\n", cli->capabilities & CAP_NOPATHINFO2, cli->capabilities & CAP_NT_SMBS, finfo->fname);
    862858        if (!(cli->capabilities & CAP_NOPATHINFO2) &&
     
    10571053        finfo->ctime = def_finfo.ctime_ts.tv_sec;
    10581054        strncpy(finfo->fname, def_finfo.name, sizeof(finfo->fname) - 1);
    1059         debug_printf( "fname %s (serverzone %d, level %d)\n",finfo->fname, cli->serverzone, level);
     1055        debuglocal(9,"fname %s (serverzone %d, level %d)\n",finfo->fname, cli->serverzone, level);
    10601056       
    10611057        switch (level) {
     
    14261422        }
    14271423        debuglocal(1,"Filelist <%s> on master <%s> wgrp <%s> server <%s> share <%s> clidev <%s>\n", state->mask, srv->master, srv->workgroup, srv->server_name, srv->share_name, cli->dev);
    1428         debug_printf( "Filelist <%s> on master <%s> wgrp <%s> server <%s> share <%s> clidev <%s>\n", state->mask, srv->master, srv->workgroup, srv->server_name, srv->share_name, cli->dev);
    14291424        if (*srv->workgroup == 0 && *srv->server_name == 0)
    14301425        {
  • branches/client-1.5/src/util.c

    r183 r189  
    9292                case 66 : return ERROR_BUSY_DRIVE ; /* EALREADY -  Operation already in progress         */
    9393        }
    94         debug_printf( "Unhandled return code %d\n");
     94//      debug_printf( "Unhandled return code %d\n");
    9595        return rc + 40000;
    9696}
Note: See TracChangeset for help on using the changeset viewer.