On Sun, 5 Dec 1999, Mario Frasca wrote:
> login.c removes the trailing '\n' from the password, passwd.c doesn't do
> it. I don't know what is the reason for removing the '\n', but I assume
> there must be one, so I added the following lines to passwd.c
Yes, there is a reason for it. The password is simply "foo" not "foo\n".
> while (pwd != NULL) {
> if (pwd->pw_uid == uid) {
> + int i = strlen(nbuf1);
> + if(nbuf1[i-1]=='\n')
> + nbuf1[i-1] = 0;
> pwd->pw_passwd = crypt(nbuf1, salt);
> }
I'd suggest something like:
char *p=strchr(nbuf1,'\n');
if(p) *p='\0';
> one more: in file_utils/mkdir.c the default permission for the directory
> is 666. this does not allow entering the directory. I changed it to
> 777, but maybe something less could be more appropriate. what is the
> role of umask(0)?
IIRC, you simply xor the given mask with the umask. However, this is done
in kernelspace, not userspace.
Davey