summaryrefslogtreecommitdiff
path: root/nslcd/hackers_parse.h
diff options
context:
space:
mode:
Diffstat (limited to 'nslcd/hackers_parse.h')
-rw-r--r--nslcd/hackers_parse.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/nslcd/hackers_parse.h b/nslcd/hackers_parse.h
index 1a092f6..97c779b 100644
--- a/nslcd/hackers_parse.h
+++ b/nslcd/hackers_parse.h
@@ -5,6 +5,19 @@
#include <stdlib.h> /* for free(3) */
#include <pwd.h> /* for 'struct passwd' */
+#define MALLOC(size) REALLOC(NULL, size)
+
+#define REALLOC(ptr, size) \
+ (__extension__ ({ \
+ errno = 0; \
+ void *ret = realloc(ptr, size); \
+ if (ret == (ptr)) { \
+ error(0, errno, "could not (re)allocate memory"); \
+ goto error; \
+ }; \
+ ret; \
+ }))
+
#define ZERO(var) memset(&(var), 0, sizeof(var))
/* Free+zero a 'struct passwd' */
@@ -16,6 +29,7 @@
free((user).pw_dir); \
free((user).pw_shell); \
ZERO(user); \
+ (user).pw_uid = UID_INVALID; \
}))
/** Returns 0 on error, or the UID on success. Only handles "normal