From: Andre Noll Date: Thu, 22 Oct 2009 20:51:20 +0000 (+0200) Subject: Merge branch 'maint' into next X-Git-Tag: v0.4.1~123 X-Git-Url: http://git.tuebingen.mpg.de/?a=commitdiff_plain;h=395aeb9da9c9cc2febe91b5a906c72e59e217594;hp=d5d96c6c65b47a34136bc04420bffd38e947bfea;p=paraslash.git Merge branch 'maint' into next --- diff --git a/daemon.c b/daemon.c index 0bc4b116..c855daa1 100644 --- a/daemon.c +++ b/daemon.c @@ -271,7 +271,11 @@ void drop_privileges_or_die(const char *username, const char *groupname) exit(EXIT_FAILURE); } PARA_INFO_LOG("dropping root privileges\n"); - setuid(p->pw_uid); + if (setuid(p->pw_uid) < 0) { + PARA_EMERG_LOG("failed to set effective user ID (%s)", + strerror(errno)); + exit(EXIT_FAILURE); + } PARA_DEBUG_LOG("uid: %d, euid: %d\n", (int)getuid(), (int)geteuid()); } @@ -329,7 +333,7 @@ __printf_2_3 void para_log(int ll, const char* fmt,...) FILE *fp; struct tm *tm; time_t t1; - char *color, str[MAXLINE] = ""; + char *color; ll = PARA_MIN(ll, NUM_LOGLEVELS - 1); ll = PARA_MAX(ll, LL_DEBUG); @@ -340,11 +344,11 @@ __printf_2_3 void para_log(int ll, const char* fmt,...) color = daemon_test_flag(DF_COLOR_LOG)? me->log_colors[ll] : NULL; if (color) fprintf(fp, "%s", color); - if (daemon_test_flag(DF_LOG_TIME)) { - /* date and time */ + if (daemon_test_flag(DF_LOG_TIME)) { /* print date and time */ + char str[100]; time(&t1); tm = localtime(&t1); - strftime(str, MAXLINE, "%b %d %H:%M:%S", tm); + strftime(str, sizeof(str), "%b %d %H:%M:%S", tm); fprintf(fp, "%s ", str); } if (daemon_test_flag(DF_LOG_HOSTNAME)) { diff --git a/user_list.c b/user_list.c index f1b4b212..525a47df 100644 --- a/user_list.c +++ b/user_list.c @@ -43,7 +43,7 @@ static void populate_user_list(char *user_list_file) struct user *u; RSA *rsa; - ret = para_fgets(line, MAXLINE, file_ptr); + ret = para_fgets(line, sizeof(line), file_ptr); if (ret <= 0) break; if (sscanf(line,"%200s %200s %200s %200s", w, n, k, p) < 3)