Changeset 1994


Ignore:
Timestamp:
Jun 6, 2008 11:10:37 PM (11 years ago)
Author:
bennylp
Message:

Added error logging when authentication fails in TURN server sample

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/src/pjturn-srv/auth.c

    r1988 r1994  
    3939}; 
    4040 
     41#define THIS_FILE       "auth.c" 
    4142#define THE_NONCE       "pjnath" 
     43#define LOG(expr)       PJ_LOG(3,expr) 
    4244 
    4345 
     
    9799    PJ_UNUSED_ARG(pool); 
    98100 
    99     if (pj_stricmp2(realm, g_realm)) 
     101    if (pj_stricmp2(realm, g_realm)) { 
     102        LOG((THIS_FILE, "auth error: invalid realm '%.*s'",  
     103                        (int)realm->slen, realm->ptr)); 
    100104        return PJ_EINVAL; 
     105    } 
    101106 
    102107    for (i=0; i<PJ_ARRAY_SIZE(g_cred); ++i) { 
     
    108113    } 
    109114 
     115    LOG((THIS_FILE, "auth error: user '%.*s' not found",  
     116                    (int)username->slen, username->ptr)); 
    110117    return PJ_ENOTFOUND; 
    111118} 
     
    127134    PJ_UNUSED_ARG(username); 
    128135 
    129     if (pj_stricmp2(nonce, THE_NONCE)) 
     136    if (pj_stricmp2(nonce, THE_NONCE)) { 
     137        LOG((THIS_FILE, "auth error: invalid nonce '%.*s'",  
     138                        (int)nonce->slen, nonce->ptr)); 
    130139        return PJ_FALSE; 
     140    } 
    131141 
    132142    return PJ_TRUE; 
Note: See TracChangeset for help on using the changeset viewer.