/*
** Folders (directories) are created with this protection (mode)
*/
-char *foldprot = "700";
+char *foldprot = "0700";
/*
** Every NEW message will be created with this protection. When a
-** message is filed it retains its protection, so this only applies
-** to messages coming in through inc.
+** message is filed it retains its protection.
*/
-char *msgprot = "600";
+char *msgprot = "0600";
void advertise(char *, char *, char *, va_list);
void advise(char *, char *, ...);
void ambigsw(char *, struct swit *);
-int atooi(char *);
char **brkstring(char *, char *, char *);
int check_charset(char *, int);
void closefds(int);
.RE
.PP
.BR Msg\-Protect :
-644
+0644
.RS 5
An octal number which defines the permission bits for new message files.
See
.BR chmod (1)
for an explanation of the octal number.
-(profile, default: 0644)
+(profile, default: 0600)
.RE
.PP
.BR Folder\-Protect :
-750
+0750
.RS 5
An octal number which defines the permission bits for new folder
directories. See
.BR chmod (1)
for an explanation of the octal number.
-(profile, default: 700)
+(profile, default: 0700)
.RE
.PP
.IR program :
SIGNAL_H = @SIGNAL_H@
# source for library functions
-SRCS = addrsbr.c ambigsw.c atooi.c brkstring.c \
+SRCS = addrsbr.c ambigsw.c brkstring.c \
check_charset.c closefds.c concat.c context_del.c \
context_find.c context_foil.c context_read.c \
context_replace.c context_save.c \
+++ /dev/null
-/*
-** atooi.c -- octal version of atoi()
-**
-** This code is Copyright (c) 2002, by the authors of nmh. See the
-** COPYRIGHT file in the root directory of the nmh distribution for
-** complete copyright information.
-*/
-
-#include <h/mh.h>
-
-
-int
-atooi(char *cp)
-{
- register int i, base;
-
- i = 0;
- base = 8;
- while (*cp >= '0' && *cp <= '7') {
- i *= base;
- i += *cp++ - '0';
- }
-
- return i;
-}
int
m_gmprot(void)
{
- register char *cp;
+ char *cp;
- return atooi ((cp = context_find("msg-protect")) && *cp ? cp : msgprot);
+ if (!(cp = context_find("msg-protect")) || !*cp) {
+ cp = msgprot;
+ }
+ return strtol(cp, NULL, 8);
}
makedir(char *dir)
{
char path[PATH_MAX];
- char* folder_perms_ASCII;
+ char *cp;
int had_an_error = 0;
mode_t folder_perms, saved_umask;
register char* c;
context_save(); /* save the context file */
fflush(stdout);
- if (!(folder_perms_ASCII = context_find("folder-protect")))
- folder_perms_ASCII = foldprot; /* defaults to "700" */
-
- /*
- ** Because mh-profile.man documents "Folder-Protect:" as an octal
- ** constant, and we don't want to force the user to remember to
- ** include a leading zero, we call atooi(folder_perms_ASCII) here
- ** rather than strtoul(folder_perms_ASCII, NULL, 0). Therefore,
- ** if anyone ever tries to specify a mode in say, hex, they'll
- ** get garbage. (I guess nmh uses its atooi() function rather
- ** than calling strtoul() with a radix of 8 because some ancient
- ** platforms are missing that functionality.
- */
- folder_perms = atooi(folder_perms_ASCII);
+ if (!(cp = context_find("folder-protect")) || !*cp) {
+ cp = foldprot;
+ }
+ folder_perms = strtoul(cp, NULL, 8);
/*
** Folders have definite desired permissions that are set -- we