Репозитории ALT
S: | 4.14.0-alt1 |
5.1: | 4.0.4.1-alt9 |
4.1: | 4.0.4.1-alt9 |
4.0: | 4.0.4.1-alt8 |
3.0: | 4.0.4.1-alt5 |
Группа :: Система/Основа
Пакет: shadow
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: shadow-4.0.4.1-owl-create-mailbox.patch
Скачать
Скачать
diff -uNrp shadow-4.0.4.1-rh-owl-redhat/src/useradd.c shadow-4.0.4.1-owl-create-mailbox/src/useradd.c
--- shadow-4.0.4.1-rh-owl-redhat/src/useradd.c 2004-02-28 14:58:46 +0000
+++ shadow-4.0.4.1-owl-create-mailbox/src/useradd.c 2004-02-28 15:35:59 +0000
@@ -1728,6 +1728,41 @@ static void create_home (void)
}
}
+static void
+create_mailbox(void)
+{
+ char *spool, *file;
+ int fd;
+ struct group *gr;
+ gid_t gid;
+ mode_t mode;
+
+ spool = getdef_str("MAIL_DIR") ?: "/var/mail";
+ file = alloca(strlen(spool) + strlen(user_name) + 2);
+ sprintf(file, "%s/%s", spool, user_name);
+ fd = open(file, O_CREAT | O_WRONLY | O_TRUNC | O_EXCL, 0);
+ if (fd < 0) {
+ perror("Creating mailbox");
+ return;
+ }
+
+ gr = getgrnam("mail");
+ if (!gr) {
+ fprintf(stderr, "Group \"mail\" not found, "
+ "creating the mailbox mode 0600.\n");
+ gid = user_gid;
+ mode = 0600;
+ } else {
+ gid = gr->gr_gid;
+ mode = 0660;
+ }
+
+ if (fchown(fd, user_id, gid) || fchmod(fd, mode))
+ perror("Setting mailbox permissions");
+
+ close(fd);
+}
+
#ifdef USE_PAM
static struct pam_conv conv = {
misc_conv,
@@ -1904,6 +1939,7 @@ int main (int argc, char **argv)
if (mflg) {
create_home ();
+ create_mailbox ();
copy_tree (def_template, user_home, user_id, user_gid, 1);
}