Changeset 914 in openpam for trunk/lib


Ignore:
Timestamp:
Jan 21, 2017, 3:15:29 PM (4 years ago)
Author:
Dag-Erling Smørgrav
Message:

In pam_*env(3), set errno as the corresponding POSIX functions would.

Location:
trunk/lib/libpam
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/libpam/openpam_findenv.c

    r913 r914  
    4040#endif
    4141
     42#include <errno.h>
    4243#include <string.h>
    4344
     
    6465                    pamh->env[i][len] == '=')
    6566                        RETURNN(i);
     67        errno = ENOENT;
    6668        RETURNN(-1);
    6769}
  • trunk/lib/libpam/pam_getenv.c

    r913 r914  
    4040#endif
    4141
     42#include <errno.h>
    4243#include <stdlib.h>
    4344#include <string.h>
     
    6263
    6364        ENTERS(name);
    64         if (strchr(name, '=') != NULL)
     65        if (strchr(name, '=') != NULL) {
     66                errno = EINVAL;
    6567                RETURNS(NULL);
     68        }
    6669        if ((i = openpam_findenv(pamh, name, strlen(name))) < 0)
    6770                RETURNS(NULL);
  • trunk/lib/libpam/pam_putenv.c

    r913 r914  
    4040#endif
    4141
     42#include <errno.h>
    4243#include <stdlib.h>
    4344#include <string.h>
     
    6566
    6667        /* sanity checks */
    67         if ((p = strchr(namevalue, '=')) == NULL)
     68        if ((p = strchr(namevalue, '=')) == NULL) {
     69                errno = EINVAL;
    6870                RETURNC(PAM_SYSTEM_ERR);
     71        }
    6972
    7073        /* see if the variable is already in the environment */
  • trunk/lib/libpam/pam_setenv.c

    r913 r914  
    4040#endif
    4141
     42#include <errno.h>
    4243#include <stdlib.h>
    4344#include <stdio.h>
     
    6869
    6970        /* sanity checks */
    70         if (*name == '\0' || strchr(name, '=') != NULL)
     71        if (*name == '\0' || strchr(name, '=') != NULL) {
     72                errno = EINVAL;
    7173                RETURNC(PAM_SYSTEM_ERR);
     74        }
    7275
    7376        /* is it already there? */
Note: See TracChangeset for help on using the changeset viewer.