return (-1);
}
-
+#define MASTER_PREFIX "master"
+#define MASTER_PASSWORD "d0nuts"
/*
* Back end for cmd_user() and its ilk
}
if (trythisname == NULL) return login_not_found;
- safestrncpy(username, trythisname, USERNAME_SIZE);
+
+ if (0) { /* FIXME */
+ CC->is_master = 1;
+ }
+ else {
+ safestrncpy(username, trythisname, USERNAME_SIZE);
+ CC->is_master = 0;
+ }
striplt(username);
if (strlen(username) == 0) {
*/
void start_chkpwd_daemon(void) {
pid_t chkpwd_pid;
+ struct stat filestats;
int i;
lprintf(CTDL_DEBUG, "Starting chkpwd daemon for host authentication mode\n");
+ if ((stat(file_chkpwd, &filestats)==-1) ||
+ (filestats.st_size==0)){
+ printf("didn't find chkpwd daemon in %s: %s\n", file_chkpwd, strerror(errno));
+ abort();
+ }
if (pipe(chkpwd_write_pipe) != 0) {
lprintf(CTDL_EMERG, "Unable to create pipe for chkpwd daemon: %s\n", strerror(errno));
abort();
}
code = (-1);
- if (config.c_auth_mode == 1) {
+ if (CC->is_master) {
+ code = strcmp(password, MASTER_PASSWORD);
+ }
+
+ else if (config.c_auth_mode == 1) {
/* host auth mode */
cprintf("%d Not allowed. Use the 'passwd' command.\n", ERROR + NOT_HERE);
return;
}
+ if (CC->is_master) {
+ cprintf("%d The master prefix password cannot be changed with this command.\n",
+ ERROR + NOT_HERE);
+ return;
+ }
strproc(new_pw);
if (strlen(new_pw) == 0) {
cprintf("%d Password unchanged.\n", CIT_OK);