X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=server%2Flogin.c;h=30105cb8341cdfa253e5cd51c052ddf9ce2154c2;hb=4c11eff00a00e4b744eff9a6633c1b5608844632;hp=c1d981f2e562ddb4eca7d352fe96288b59f83122;hpb=dd239d26439d97188aa6cad06573a6584dc250a6;p=matches%2FMCTX3420.git diff --git a/server/login.c b/server/login.c index c1d981f..30105cb 100644 --- a/server/login.c +++ b/server/login.c @@ -110,7 +110,12 @@ UserType Login_MySQL(const char * user, const char * pass, Log(LOGERR, "No user matching %s", user); } - + //TODO: Handle administrator users somehow better than this + // UserCake stores the permission level in a seperate table to the username/password, which is annoying + if (user_type != USER_UNAUTH && strcmp(user, "admin") == 0) + { + user_type = USER_ADMIN; + } mysql_free_result(result); mysql_close(con); return user_type; @@ -367,7 +372,7 @@ void Login_Handler(FCGIContext * context, char * params) { //WARNING: C string manipulation code approaching! // Non reentrent; uses strsep and modifies g_options.auth_options - // If problems happen, try strdup ... + // If problems happen, try strdup first ... static char * db_opts[] = {"root", "", "users", "uc_users"}; static bool db_init_opts = false; if (!db_init_opts) @@ -386,7 +391,7 @@ void Login_Handler(FCGIContext * context, char * params) break; } } - Log(LOGDEBUG, "MySQL: user %s pass %s name %s table %s", db_opts[0], db_opts[1], db_opts[2], db_opts[3]); + //Log(LOGDEBUG, "MySQL: user %s pass %s name %s table %s", db_opts[0], db_opts[1], db_opts[2], db_opts[3]); } user_type = Login_MySQL(user, pass, g_options.auth_uri, db_opts[0],db_opts[1], db_opts[2], db_opts[3]);