diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-08-23 21:49:58 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-08-23 21:49:58 +0100 |
commit | ce80202cfcf7f0dcb80e055eba3f6475232a5961 (patch) | |
tree | cbcbc1415a53efca01b7bc3daab62ea7fde9d047 /mail-mta/courier/files | |
parent | 41ba6a36cf63678ca63fdd9788e84e3e032dc4ba (diff) |
gentoo auto-resync : 23:08:2023 - 21:49:58
Diffstat (limited to 'mail-mta/courier/files')
-rw-r--r-- | mail-mta/courier/files/courier-1.2.2-fix-getgrnam-buffer.diff | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/mail-mta/courier/files/courier-1.2.2-fix-getgrnam-buffer.diff b/mail-mta/courier/files/courier-1.2.2-fix-getgrnam-buffer.diff deleted file mode 100644 index 73384098189c..000000000000 --- a/mail-mta/courier/files/courier-1.2.2-fix-getgrnam-buffer.diff +++ /dev/null @@ -1,120 +0,0 @@ -diff -Naurp a/libs/numlib/changeuidgid.c b/libs/numlib/changeuidgid.c ---- a/libs/numlib/changeuidgid.c 2022-03-06 20:02:45.000000000 +0100 -+++ b/libs/numlib/changeuidgid.c 2023-02-24 17:26:02.452835861 +0100 -@@ -52,10 +52,11 @@ void libmail_changeuidgid(uid_t uid, gid - */ - uid_t libmail_getuid(const char *uname, gid_t *pw_gid) - { -- size_t bufsize; -+ int bufsize; - char *buf; - struct passwd pwbuf; - struct passwd *pw; -+ int s; - - /* - ** uname might be a pointer returned from a previous called to getpw(), -@@ -70,35 +71,39 @@ uid_t libmail_getuid(const char *uname, - } - strcpy(p, uname); - --#ifdef _SC_GETGR_R_SIZE_MAX -- bufsize = sysconf(_SC_GETGR_R_SIZE_MAX); -+#ifdef _SC_GETPW_R_SIZE_MAX -+ bufsize = sysconf(_SC_GETPW_R_SIZE_MAX); - if (bufsize == -1) /* Value was indeterminate */ -- { - #endif -- bufsize = 16384; /* Should be more than enough */ -- } -- -- buf = malloc(bufsize); -- if (buf == NULL) - { -- perror("malloc"); -- exit(1); -+ bufsize = 16384; /* Should be more than enough */ - } - -+ do { -+ buf = malloc(bufsize); -+ if (buf == NULL) -+ { -+ perror("malloc"); -+ exit(1); -+ } - -- errno=ENOENT; -- -- getpwnam_r(p, &pwbuf, buf, bufsize, &pw); -+ s = getpwnam_r(p, &pwbuf, buf, bufsize, &pw); -+ if (s == ERANGE) { -+ free(buf); -+ bufsize += 1024; -+ } -+ } while (s == ERANGE && bufsize <= 65536); - -- free(buf); -+ free(p); - - if (pw == 0) - { -- free(p); -- perror("getpwnam"); -+ errno = s; -+ perror("getpwnam_r"); - exit(1); - } -- free(p); -+ -+ free(buf); - - if ( pw_gid ) *pw_gid = pw->pw_gid; - -@@ -149,7 +154,7 @@ gid_t libmail_getgid(const char *gname) - struct group grp; - struct group *result; - char *buf; -- size_t bufsize; -+ int bufsize; - int s; - char *p=malloc(strlen(gname)+1); - -@@ -168,14 +173,21 @@ gid_t libmail_getgid(const char *gname) - bufsize = 16384; /* Should be more than enough */ - } - -- buf = malloc(bufsize); -- if (buf == NULL) -- { -- perror("malloc"); -- exit(1); -- } -+ do { -+ buf = malloc(bufsize); -+ if (buf == NULL) -+ { -+ perror("malloc"); -+ exit(1); -+ } -+ -+ s = getgrnam_r(p, &grp, buf, bufsize, &result); -+ if (s == ERANGE) { -+ free(buf); -+ bufsize += 1024; -+ } -+ } while (s == ERANGE && bufsize <= 65536); - -- s = getgrnam_r(p, &grp, buf, bufsize, &result); - free(p); - - if (result == NULL) -@@ -187,7 +199,7 @@ gid_t libmail_getgid(const char *gname) - else - { - errno = s; -- perror("getpwnam_r"); -+ perror("getgrnam_r"); - } - exit(1); - } |