diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-01-28 16:42:52 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-01-28 16:42:52 +0200 |
commit | 947e0c2f8a39f072b72c7a2e5307045cb03002ac (patch) | |
tree | 47a3db70c782c076d435ea745f9e71c09b1fa635 /lib | |
parent | 399768dde3450a6184859ae0929f7debbe3521e3 (diff) | |
download | pam-modules-947e0c2f8a39f072b72c7a2e5307045cb03002ac.tar.gz pam-modules-947e0c2f8a39f072b72c7a2e5307045cb03002ac.tar.bz2 |
pam_ldaphome: run initrc command as user.
* examples/usergitconfig: Documentation formatting change.
* lib/graypam.h (gray_2nrealloc): New function.
* lib/mem.c (gray_2nrealloc): New function.
* pam_fshadow/pam_fshadow.c (fgetpwent): Skip malformed entries.
* pam_ldaphome/pam_ldaphome.c (runas): New finction.
(run_prog): Switch to user privileges unless initrc-root is true.
* NEWS: Update.
* doc/pam-modules.texi: Update.
* doc/pam_ldaphome.8in: Update.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/graypam.h | 1 | ||||
-rw-r--r-- | lib/mem.c | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/graypam.h b/lib/graypam.h index e6b68aa..2548c74 100644 --- a/lib/graypam.h +++ b/lib/graypam.h @@ -94,6 +94,7 @@ void *gray_malloc(size_t size); void *gray_zalloc(size_t size); void *gray_calloc(size_t count, size_t size); void *gray_realloc(void *ptr, size_t size); +void *gray_2nrealloc(void *ptr, size_t *pcount, size_t elsiz); char *gray_strdup(const char *str); void gray_pam_delete(char *x); @@ -62,6 +62,24 @@ gray_realloc(void *ptr, size_t size) return ptr; } +void * +gray_2nrealloc(void *ptr, size_t *pcount, size_t elsiz) +{ + size_t count = *pcount; + + if (!ptr) { + if (!count) + count = *pcount = 16; + return gray_calloc(count, elsiz); + } + if ((size_t)-1 / 2 / elsiz <= count) + gray_raise("Not enough memory"); + count *= 2; + *pcount = count; + return gray_realloc(ptr, count * elsiz); +} + + char * gray_strdup(const char *str) { |