version 1.1.1.2, 2012/05/29 12:26:49
|
version 1.1.1.5, 2013/10/14 07:56:33
|
Line 1
|
Line 1
|
/* |
/* |
* Copyright (c) 2008, 2010-2011 Todd C. Miller <Todd.Miller@courtesan.com> | * Copyright (c) 2008, 2010-2013 Todd C. Miller <Todd.Miller@courtesan.com> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
Line 33
|
Line 33
|
|
|
#include "missing.h" |
#include "missing.h" |
#include "alloc.h" |
#include "alloc.h" |
#include "error.h" | #include "fatal.h" |
#include "sudo_debug.h" |
#include "sudo_debug.h" |
|
|
#define DEFAULT_TEXT_DOMAIN "sudo" |
#define DEFAULT_TEXT_DOMAIN "sudo" |
Line 90 aix_setlimits(char *user)
|
Line 90 aix_setlimits(char *user)
|
debug_decl(aix_setlimits, SUDO_DEBUG_UTIL) |
debug_decl(aix_setlimits, SUDO_DEBUG_UTIL) |
|
|
if (setuserdb(S_READ) != 0) |
if (setuserdb(S_READ) != 0) |
error(1, "unable to open userdb"); | fatal("unable to open userdb"); |
|
|
/* |
/* |
* For each resource limit, get the soft/hard values for the user |
* For each resource limit, get the soft/hard values for the user |
Line 108 aix_setlimits(char *user)
|
Line 108 aix_setlimits(char *user)
|
else |
else |
rlim.rlim_cur = rlim.rlim_max; /* soft not specd, use hard */ |
rlim.rlim_cur = rlim.rlim_max; /* soft not specd, use hard */ |
} else { |
} else { |
/* No hard limit set, try soft limit. */ | /* No hard limit set, try soft limit, if it exists. */ |
if (aix_getlimit(user, aix_limits[n].soft, &val) == 0) | if (aix_getlimit(user, aix_limits[n].soft, &val) == -1) |
rlim.rlim_cur = val == -1 ? RLIM64_INFINITY : val * aix_limits[n].factor; | continue; |
| rlim.rlim_cur = val == -1 ? RLIM64_INFINITY : val * aix_limits[n].factor; |
|
|
/* Set hard limit per AIX /etc/security/limits documentation. */ |
/* Set hard limit per AIX /etc/security/limits documentation. */ |
switch (aix_limits[n].resource) { |
switch (aix_limits[n].resource) { |
Line 146 aix_setauthdb(char *user)
|
Line 147 aix_setauthdb(char *user)
|
|
|
if (user != NULL) { |
if (user != NULL) { |
if (setuserdb(S_READ) != 0) |
if (setuserdb(S_READ) != 0) |
error(1, _("unable to open userdb")); | fatal(_("unable to open userdb")); |
if (getuserattr(user, S_REGISTRY, ®istry, SEC_CHAR) == 0) { |
if (getuserattr(user, S_REGISTRY, ®istry, SEC_CHAR) == 0) { |
if (setauthdb(registry, NULL) != 0) |
if (setauthdb(registry, NULL) != 0) |
error(1, _("unable to switch to registry \"%s\" for %s"), | fatal(_("unable to switch to registry \"%s\" for %s"), |
registry, user); |
registry, user); |
} |
} |
enduserdb(); |
enduserdb(); |
Line 166 aix_restoreauthdb(void)
|
Line 167 aix_restoreauthdb(void)
|
debug_decl(aix_setauthdb, SUDO_DEBUG_UTIL) |
debug_decl(aix_setauthdb, SUDO_DEBUG_UTIL) |
|
|
if (setauthdb(NULL, NULL) != 0) |
if (setauthdb(NULL, NULL) != 0) |
error(1, _("unable to restore registry")); | fatal(_("unable to restore registry")); |
|
|
debug_return; |
debug_return; |
} |
} |