View | Details | Raw Unified | Return to bug 22033
Collapse All | Expand All

(-)pw_dir2/pw.8 (+3 lines)
Lines 604-609 Link Here
604
force a blank password
604
force a blank password
605
.It random
605
.It random
606
generate a random password
606
generate a random password
607
.It crypt
608
the supplied password is encrypted. Suitable only with
609
.Ql Fl h
607
.El
610
.El
608
.Pp
611
.Pp
609
The
612
The
(-)pw_dir2/pw_conf.c (+5 lines)
Lines 187-192 Link Here
187
			return -1;
187
			return -1;
188
		if (strcmp(str, "none") == 0)
188
		if (strcmp(str, "none") == 0)
189
			return -2;
189
			return -2;
190
		/*
191
		 * Special case for encrypted password
192
		 */
193
		if (strcmp(str, "crypt") == 0)
194
			return -3;
190
	}
195
	}
191
	return dflt;
196
	return dflt;
192
}
197
}
(-)pw_dir2/pw_group.c (-1 / +10 lines)
Lines 196-202 Link Here
196
				*p = '\0';
196
				*p = '\0';
197
			if (!*line)
197
			if (!*line)
198
				errx(EX_DATAERR, "empty password read on file descriptor %d", fd);
198
				errx(EX_DATAERR, "empty password read on file descriptor %d", fd);
199
			grp->gr_passwd = pw_pwcrypt(line);
199
			if (((arg = getarg(args, 'w')) != NULL) &&
200
				(boolean_val(arg->val, cnf->default_password) == -3)) {
201
				int i;
202
                                for (i = 0; i < strlen(line); i++) {
203
                                        if (line[i] == ':')
204
                                                return EX_DATAERR;
205
                                }
206
				grp->gr_passwd = line;
207
			} else
208
				grp->gr_passwd = pw_pwcrypt(line);
200
		}
209
		}
201
	}
210
	}
202
211
(-)pw_dir2/pw_user.c (-6 / +18 lines)
Lines 643-654 Link Here
643
				*p = '\0';
643
				*p = '\0';
644
			if (!*line)
644
			if (!*line)
645
				errx(EX_DATAERR, "empty password read on file descriptor %d", fd);
645
				errx(EX_DATAERR, "empty password read on file descriptor %d", fd);
646
			lc = login_getpwclass(pwd);
646
			/* check for encrypted/literal password in file descriptor */
647
			if (lc == NULL ||
647
			if (((arg = getarg(args, 'w')) != NULL) &&
648
			    login_setcryptfmt(lc, "md5", NULL) == NULL)
648
				(boolean_val(arg->val, cnf->default_password) == -3)) {
649
				warn("setting crypt(3) format");
649
				int i;
650
			login_close(lc);
650
				/* password is encrypted - check for ':' in password */
651
			pwd->pw_passwd = pw_pwcrypt(line);
651
				for (i = 0; i < strlen(line); i++) {
652
					if (line[i] == ':') 
653
						return EX_DATAERR;
654
				}
655
				pwd->pw_passwd = line;
656
			} else {			
657
				lc = login_getpwclass(pwd);
658
				if (lc == NULL ||
659
				    login_setcryptfmt(lc, "md5", NULL) == NULL)
660
					warn("setting crypt(3) format");
661
				login_close(lc);
662
				pwd->pw_passwd = pw_pwcrypt(line);
663
			}
652
			edited = 1;
664
			edited = 1;
653
		}
665
		}
654
	}
666
	}

Return to bug 22033