diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-03-10 23:25:11 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-03-10 23:26:52 +0200 |
commit | 39a97e438dde837ada9a99cceea93a1cf97db19e (patch) | |
tree | efc492dcfcdc2c21bfdec5c31692b348601cd94a /src/userprivs.c | |
parent | 87602f5492b842f734dffe22f4e2f85dbc6ce713 (diff) | |
download | wydawca-39a97e438dde837ada9a99cceea93a1cf97db19e.tar.gz wydawca-39a97e438dde837ada9a99cceea93a1cf97db19e.tar.bz2 |
Provide a convenient debugging macro.
Rename logmsg to wy_log.
Diffstat (limited to 'src/userprivs.c')
-rw-r--r-- | src/userprivs.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/userprivs.c b/src/userprivs.c index 11285f1..13a2d87 100644 --- a/src/userprivs.c +++ b/src/userprivs.c @@ -26,7 +26,7 @@ wydawca_userprivs(uid_t uid, gid_t gid, gid_t * grplist, size_t ngrp) /* Reset group permissions */ if (geteuid() == 0 && setgroups(ngrp, grplist)) { - logmsg(LOG_CRIT, "setgroups(%lu, %lu...): %s", + wy_log(LOG_CRIT, "setgroups(%lu, %lu...): %s", (unsigned long)ngrp, (unsigned long)grplist[0], strerror(errno)); return rc; @@ -37,26 +37,26 @@ wydawca_userprivs(uid_t uid, gid_t gid, gid_t * grplist, size_t ngrp) #if defined(HAVE_SETEGID) if ((rc = setegid(gid)) < 0) - logmsg(LOG_CRIT, "setegid(%lu): %s", + wy_log(LOG_CRIT, "setegid(%lu): %s", (unsigned long)gid, strerror(errno)); #elif defined(HAVE_SETREGID) if ((rc = setregid(gid, gid)) < 0) - logmsg(LOG_CRIT, "setregid(%lu,%lu)d: %s", + wy_log(LOG_CRIT, "setregid(%lu,%lu)d: %s", (unsigned long)gid, (unsigned long)gid, strerror(errno)); #elif defined(HAVE_SETRESGID) if ((rc = setresgid(gid, gid, gid)) < 0) - logmsg(LOG_CRIT, "setresgid(%lu,%lu,%lu): %s", + wy_log(LOG_CRIT, "setresgid(%lu,%lu,%lu): %s", (unsigned long)gid, (unsigned long)gid, (unsigned long)gid, strerror(errno)); #endif if (rc == 0 && gid != 0) { if ((rc = setgid(gid)) < 0 && getegid() != gid) - logmsg(LOG_CRIT, "setgid(%lu): %s", + wy_log(LOG_CRIT, "setgid(%lu): %s", (unsigned long)gid, strerror(errno)); if (rc == 0 && getegid() != gid) { - logmsg(LOG_CRIT, _("cannot set effective gid to %lu"), + wy_log(LOG_CRIT, _("cannot set effective gid to %lu"), (unsigned long)gid); rc = 1; } @@ -73,14 +73,14 @@ wydawca_userprivs(uid_t uid, gid_t gid, gid_t * grplist, size_t ngrp) #if defined(HAVE_SETREUID) if (geteuid() != uid) { if (setreuid(uid, -1) < 0) { - logmsg(LOG_CRIT, + wy_log(LOG_CRIT, "setreuid(%lu,-1): %s", (unsigned long)uid, strerror(errno)); rc = 1; } if (setuid(uid) < 0) { - logmsg(LOG_CRIT, + wy_log(LOG_CRIT, "setreuid(%lu,-1): %s", (unsigned long)uid, strerror(errno)); @@ -89,7 +89,7 @@ wydawca_userprivs(uid_t uid, gid_t gid, gid_t * grplist, size_t ngrp) } else #endif { - logmsg(LOG_CRIT, "setuid(%lu): %s", + wy_log(LOG_CRIT, "setuid(%lu): %s", (unsigned long)uid, strerror(errno)); rc = 1; } @@ -97,11 +97,11 @@ wydawca_userprivs(uid_t uid, gid_t gid, gid_t * grplist, size_t ngrp) euid = geteuid(); if (uid != 0 && setuid(0) == 0) { - logmsg(LOG_CRIT, + wy_log(LOG_CRIT, _("seteuid(0) succeeded when it should not")); rc = 1; } else if (uid != euid && setuid(euid) == 0) { - logmsg(LOG_CRIT, + wy_log(LOG_CRIT, _("cannot drop non-root setuid privileges")); rc = 1; } |