src/mn-masterd/auth.c
static int
check_user_login(const char *user, const char *pwd)
{
    char buf[64*3];
    int len;
    MYSQL_RES *r;
    MYSQL_ROW row;
    int ret = -1;

    strrmsq(user);
    strrmsq(pwd);

    len = sprintf(buf, "SELECT id FROM nol_user WHERE user = '%s' AND pass = MD5('%s');",
            user, pwd);
    if (mysql_real_query(srv.mysql, buf, len) == 0) {
        if ((r = mysql_store_result(srv.mysql))) {
            if ((row = mysql_fetch_row(r)))
               ret = atoi(row[0]);
            mysql_free_result(r);
        }
    } else {
        syslog(LOG_ERR, "user auth error: %s", mysql_error(srv.mysql));
    }

    return ret;
}
/**
 * verify the login
 *
 * this function does NOT check for buffer overflows using 
 * long user or pwd strings, and should only be used 
 * where those two have already been cut
 *
 * return the user id on success, or -1 if the login 
 * failed.
 **/
verify the login
this function does NOT check for buffer overflows using
long user or pwd strings, and should only be used
where those two have already been cut

return the user id on success, or -1 if the login
failed.
verify the login this function does NOT check for buffer overflows using long user or pwd strings and should only be used where those two have already been cut return the user id on success or - 1 if the login failed .
static int
check_user_login(const char *user, const char *pwd)
{
    char buf[64*3];
    int len;
    MYSQL_RES *r;
    MYSQL_ROW row;
    int ret = -1;
    strrmsq(user);
    strrmsq(pwd);
    len = sprintf(buf, "SELECT id FROM nol_user WHERE user = '%s' AND pass = MD5('%s');",
            user, pwd);
    if (mysql_real_query(srv.mysql, buf, len) == 0) {
        if ((r = mysql_store_result(srv.mysql))) {
            if ((row = mysql_fetch_row(r)))
               ret = atoi(row[0]);
            mysql_free_result(r);
        }
    } else {
        syslog(LOG_ERR, "user auth error: %s", mysql_error(srv.mysql));
    }
    return ret;
}
static int check_user_login ( const char * user , const char * pwd ) { char buf [ 64 * 3 ] ; int len ; MYSQL_RES * r ; MYSQL_ROW row ; int ret = -1 ; strrmsq ( user ) ; strrmsq ( pwd ) ; len = sprintf ( buf , " " , user , pwd ) ; if ( mysql_real_query ( srv . mysql , buf , len ) == 0 ) { if ( ( r = mysql_store_result ( srv . mysql ) ) ) { if ( ( row = mysql_fetch_row ( r ) ) ) ret = atoi ( row [ 0 ] ) ; mysql_free_result ( r ) ; } } else { syslog ( LOG_ERR , " " , mysql_error ( srv . mysql ) ) ; } return ret ; }
verify the login
 this function does NOT check for buffer overflows using
 long user or pwd strings, and should only be used
 where those two have already been cut
verify the login this function does NOT check for buffer overflows using long user or pwd strings and should only be used where those two have already been cut