Use clicon_err() consistently and drop perror()
This commit is contained in:
parent
9d9528d503
commit
959e060995
5 changed files with 65 additions and 59 deletions
|
|
@ -173,6 +173,8 @@ drop_priv_temp(uid_t new_uid)
|
|||
#ifdef HAVE_GETRESUID
|
||||
int retval = -1;
|
||||
|
||||
clicon_debug(CLIXON_DBG_DEFAULT, "%s uid:%u", __FUNCTION__, new_uid);
|
||||
|
||||
/* XXX: implicit declaration of function 'setresuid' on travis */
|
||||
if (setresuid(-1, new_uid, geteuid()) < 0){
|
||||
clicon_err(OE_UNIX, errno, "setresuid");
|
||||
|
|
@ -186,7 +188,7 @@ drop_priv_temp(uid_t new_uid)
|
|||
done:
|
||||
return retval;
|
||||
#else
|
||||
clicon_debug(1, "%s Drop privileges not implemented on this platform since getresuid is not available", __FUNCTION__);
|
||||
clicon_debug(CLIXON_DBG_DEFAULT, "%s Drop privileges not implemented on this platform since getresuid is not available", __FUNCTION__);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -203,6 +205,8 @@ drop_priv_perm(uid_t new_uid)
|
|||
uid_t euid;
|
||||
uid_t suid;
|
||||
|
||||
clicon_debug(CLIXON_DBG_DEFAULT, "%s uid:%u", __FUNCTION__, new_uid);
|
||||
|
||||
if (setresuid(new_uid, new_uid, new_uid) < 0){
|
||||
clicon_err(OE_UNIX, errno, "setresuid");
|
||||
goto done;
|
||||
|
|
@ -221,7 +225,7 @@ drop_priv_perm(uid_t new_uid)
|
|||
done:
|
||||
return retval;
|
||||
#else
|
||||
clicon_debug(1, "%s Drop privileges not implemented on this platform since getresuid is not available", __FUNCTION__);
|
||||
clicon_debug(CLIXON_DBG_DEFAULT, "%s Drop privileges not implemented on this platform since getresuid is not available", __FUNCTION__);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -235,7 +239,9 @@ restore_priv(void)
|
|||
uid_t ruid;
|
||||
uid_t euid;
|
||||
uid_t suid;
|
||||
|
||||
|
||||
clicon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
|
||||
if (getresuid(&ruid, &euid, &suid) < 0){
|
||||
clicon_err(OE_UNIX, errno, "setresuid");
|
||||
goto done;
|
||||
|
|
@ -252,7 +258,7 @@ restore_priv(void)
|
|||
done:
|
||||
return retval;
|
||||
#else
|
||||
clicon_debug(1, "%s Drop privileges not implemented on this platform since getresuid is not available", __FUNCTION__);
|
||||
clicon_debug(CLIXON_DBG_DEFAULT, "%s Drop privileges not implemented on this platform since getresuid is not available", __FUNCTION__);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue