Группа :: Система/Серверы
Пакет: postfix
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: postfix-2.2.4-alt-local_minimum_uid.patch
diff -upk.orig postfix-2.2.4.orig/src/global/mail_params.c postfix-2.2.4/src/global/mail_params.c
--- postfix-2.2.4.orig/src/global/mail_params.c 2005-06-23 12:47:30 +0000
+++ postfix-2.2.4/src/global/mail_params.c 2005-06-23 12:49:30 +0000
@@ -28,6 +28,7 @@
/* char *var_daemon_dir;
/* char *var_command_dir;
/* char *var_queue_dir;
+/* int var_local_minimum_uid;
/* int var_use_limit;
/* int var_idle_limit;
/* int var_event_drain;
@@ -190,6 +191,7 @@ char *var_config_dir;
char *var_daemon_dir;
char *var_command_dir;
char *var_queue_dir;
+int var_local_minimum_uid;
int var_use_limit;
int var_event_drain;
int var_idle_limit;
@@ -538,6 +540,7 @@ void mail_params_init()
0,
};
static CONFIG_INT_TABLE other_int_defaults[] = {
+ VAR_LOCAL_MINUID, DEF_LOCAL_MINUID, &var_local_minimum_uid, 0, 0,
VAR_MAX_USE, DEF_MAX_USE, &var_use_limit, 1, 0,
VAR_DONT_REMOVE, DEF_DONT_REMOVE, &var_dont_remove, 0, 0,
VAR_LINE_LIMIT, DEF_LINE_LIMIT, &var_line_limit, 512, 0,
diff -upk.orig postfix-2.2.4.orig/src/global/mail_params.h postfix-2.2.4/src/global/mail_params.h
--- postfix-2.2.4.orig/src/global/mail_params.h 2005-06-23 12:37:33 +0000
+++ postfix-2.2.4/src/global/mail_params.h 2005-06-23 12:49:30 +0000
@@ -455,6 +455,10 @@ extern char *var_alias_db_map;
#define DEF_LUSER_RELAY ""
extern char *var_luser_relay;
+#define VAR_LOCAL_MINUID "local_minimum_uid"
+#define DEF_LOCAL_MINUID 500
+extern int var_local_minimum_uid;
+
/*
* Local delivery: mailbox delivery.
*/
diff -upk.orig postfix-2.2.4.orig/src/global/mypwd.c postfix-2.2.4/src/global/mypwd.c
--- postfix-2.2.4.orig/src/global/mypwd.c 2000-11-20 18:05:27 +0000
+++ postfix-2.2.4/src/global/mypwd.c 2005-02-27 00:04:57 +0000
@@ -46,6 +46,7 @@
#include <sys_defs.h>
#include <pwd.h>
+#include <errno.h>
#include <string.h>
#ifdef USE_PATHS_H
#include <paths.h>
@@ -62,6 +63,8 @@
#include "mypwd.h"
+extern int var_local_minimum_uid;
+
/*
* The private cache. One for lookups by name, one for lookups by uid, and
* one for the last looked up result.
@@ -162,6 +165,10 @@ struct mypasswd *mypwnam(const char *nam
if ((mypwd = (struct mypasswd *) htable_find(mypwcache_name, name)) == 0) {
if ((pwd = getpwnam(name)) == 0)
return (0);
+ if ((int) pwd->pw_uid < var_local_minimum_uid) {
+ errno = ENOENT;
+ return (0);
+ }
mypwd = mypwenter(pwd);
}
last_pwd = mypwd;
diff -upk.orig postfix-2.2.4.orig/src/util/dict_unix.c postfix-2.2.4/src/util/dict_unix.c
--- postfix-2.2.4.orig/src/util/dict_unix.c 2002-12-20 00:08:49 +0000
+++ postfix-2.2.4/src/util/dict_unix.c 2005-02-27 00:04:57 +0000
@@ -54,6 +54,8 @@
#include "dict.h"
#include "dict_unix.h"
+extern int var_local_minimum_uid;
+
/* Application-specific. */
typedef struct {
@@ -81,6 +83,10 @@ static const char *dict_unix_getpwnam(DI
}
return (0);
} else {
+ if ((int) pwd->pw_uid < var_local_minimum_uid) {
+ errno = ENOENT;
+ return (0);
+ }
if (buf == 0)
buf = vstring_alloc(10);
sanity_checked = 1;