void *new_buffer;
struct group *result = NULL;
- new_buffer = realloc(buffer, sizeof(struct passwd) + length);
+ new_buffer = realloc(buffer, sizeof(struct group) + length);
if (new_buffer == NULL) {
D(("out of memory"));
buffer = new_buffer;
/* make the re-entrant call to get the grp structure */
+ errno = 0;
status = getgrgid_r(gid, buffer,
sizeof(struct group) + (char *) buffer,
length, &result);
free(buffer);
return NULL;
+ } else if (errno != ERANGE && errno != EINTR) {
+ /* no sense in repeating the call */
+ break;
}
- length <<= 1;
+ length <<= 2;
} while (length < PWD_ABSURD_PWD_LENGTH);
void *new_buffer;
struct group *result = NULL;
- new_buffer = realloc(buffer, sizeof(struct passwd) + length);
+ new_buffer = realloc(buffer, sizeof(struct group) + length);
if (new_buffer == NULL) {
D(("out of memory"));
buffer = new_buffer;
/* make the re-entrant call to get the grp structure */
+ errno = 0;
status = getgrnam_r(group, buffer,
sizeof(struct group) + (char *) buffer,
length, &result);
free(buffer);
return NULL;
- }
+ } else if (errno != ERANGE && errno != EINTR) {
+ /* no sense in repeating the call */
+ break;
+ }
- length <<= 1;
+ length <<= 2;
} while (length < PWD_ABSURD_PWD_LENGTH);
buffer = new_buffer;
/* make the re-entrant call to get the pwd structure */
+ errno = 0;
status = getpwnam_r(user, buffer,
sizeof(struct passwd) + (char *) buffer,
length, &result);
free(buffer);
return NULL;
- }
+ } else if (errno != ERANGE && errno != EINTR) {
+ /* no sense in repeating the call */
+ break;
+ }
- length <<= 1;
+ length <<= 2;
} while (length < PWD_ABSURD_PWD_LENGTH);
buffer = new_buffer;
/* make the re-entrant call to get the pwd structure */
+ errno = 0;
status = getpwuid_r(uid, buffer,
sizeof(struct passwd) + (char *) buffer,
length, &result);
free(buffer);
return NULL;
- }
+ } else if (errno != ERANGE && errno != EINTR) {
+ /* no sense in repeating the call */
+ break;
+ }
- length <<= 1;
+ length <<= 2;
} while (length < PWD_ABSURD_PWD_LENGTH);
buffer = new_buffer;
/* make the re-entrant call to get the spwd structure */
+ errno = 0;
status = getspnam_r(user, buffer,
sizeof(struct spwd) + (char *) buffer,
length, &result);
free(buffer);
return NULL;
- }
+ } else if (errno != ERANGE && errno != EINTR) {
+ /* no sense in repeating the call */
+ break;
+ }
- length <<= 1;
+ length <<= 2;
} while (length < PWD_ABSURD_PWD_LENGTH);
#include <security/_pam_modutil.h>
#define PWD_INITIAL_LENGTH 0x100
-#define PWD_ABSURD_PWD_LENGTH 0x1000
+#define PWD_ABSURD_PWD_LENGTH 0x8000
/* This is a simple cleanup, it just free()s the 'data' memory */
extern void _pammodutil_cleanup(pam_handle_t *pamh, void *data,