Changeset 234 in openpam


Ignore:
Timestamp:
May 24, 2003, 7:52:28 PM (12 years ago)
Author:
des
Message:

Return code paranoia: compare against 0 instead of -1.

Suggested by: Dmitry V. Levin <ldv@…>

Location:
trunk/lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/openpam_borrow_cred.c

    r232 r234  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_borrow_cred.c#7 $
     34 * $P4: //depot/projects/openpam/lib/openpam_borrow_cred.c#8 $
    3535 */
    3636
     
    7777        scred->egid = getegid();
    7878        r = getgroups(NGROUPS_MAX, scred->groups);
    79         if (r == -1) {
     79        if (r < 0) {
    8080                FREE(scred);
    8181                RETURNC(PAM_SYSTEM_ERR);
     
    8989        if (geteuid() == pwd->pw_uid)
    9090                RETURNC(PAM_SUCCESS);
    91         if (initgroups(pwd->pw_name, pwd->pw_gid) == -1 ||
    92               setegid(pwd->pw_gid) == -1 || seteuid(pwd->pw_uid) == -1) {
     91        if (initgroups(pwd->pw_name, pwd->pw_gid) < 0 ||
     92              setegid(pwd->pw_gid) < 0 || seteuid(pwd->pw_uid) < 0) {
    9393                openpam_restore_cred(pamh);
    9494                RETURNC(PAM_SYSTEM_ERR);
  • trunk/lib/openpam_dynamic.c

    r232 r234  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_dynamic.c#10 $
     34 * $P4: //depot/projects/openpam/lib/openpam_dynamic.c#11 $
    3535 */
    3636
     
    6363
    6464        /* try versioned module first, then unversioned module */
    65         if (asprintf(&vpath, "%s.%d", path, LIB_MAJ) == -1)
     65        if (asprintf(&vpath, "%s.%d", path, LIB_MAJ) < 0)
    6666                goto buf_err;
    6767        if ((dlh = dlopen(vpath, RTLD_LAZY)) == NULL) {
  • trunk/lib/openpam_restore_cred.c

    r224 r234  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_restore_cred.c#6 $
     34 * $P4: //depot/projects/openpam/lib/openpam_restore_cred.c#7 $
    3535 */
    3636
     
    6565                RETURNC(PAM_SYSTEM_ERR);
    6666        if (scred->euid != geteuid()) {
    67                 if (seteuid(scred->euid) == -1 ||
    68                     setgroups(scred->ngroups, scred->groups) == -1 ||
    69                     setegid(scred->egid) == -1)
     67                if (seteuid(scred->euid) < 0 ||
     68                    setgroups(scred->ngroups, scred->groups) < 0 ||
     69                    setegid(scred->egid) < 0)
    7070                        RETURNC(PAM_SYSTEM_ERR);
    7171        }
  • trunk/lib/pam_getenv.c

    r221 r234  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/pam_getenv.c#14 $
     34 * $P4: //depot/projects/openpam/lib/pam_getenv.c#15 $
    3535 */
    3636
     
    6161        if (name == NULL || strchr(name, '=') != NULL)
    6262                RETURNS(NULL);
    63         if ((i = openpam_findenv(pamh, name, strlen(name))) == -1)
     63        if ((i = openpam_findenv(pamh, name, strlen(name))) < 0)
    6464                RETURNS(NULL);
    6565        for (str = pamh->env[i]; *str != '\0'; ++str) {
  • trunk/lib/pam_putenv.c

    r232 r234  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/pam_putenv.c#10 $
     34 * $P4: //depot/projects/openpam/lib/pam_putenv.c#11 $
    3535 */
    3636
     
    6565
    6666        /* see if the variable is already in the environment */
    67         if ((i = openpam_findenv(pamh, namevalue, p - namevalue)) != -1) {
     67        if ((i = openpam_findenv(pamh, namevalue, p - namevalue)) >= 0) {
    6868                if ((p = strdup(namevalue)) == NULL)
    6969                        RETURNC(PAM_BUF_ERR);
  • trunk/lib/pam_setenv.c

    r233 r234  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/pam_setenv.c#10 $
     34 * $P4: //depot/projects/openpam/lib/pam_setenv.c#11 $
    3535 */
    3636
     
    6868
    6969        /* is it already there? */
    70         if (!overwrite && openpam_findenv(pamh, name, strlen(name)) != -1)
     70        if (!overwrite && openpam_findenv(pamh, name, strlen(name)) >= 0)
    7171                RETURNC(PAM_SUCCESS);
    7272
Note: See TracChangeset for help on using the changeset viewer.