version 1.6, 2002/06/28 22:28:17 |
version 1.7, 2004/03/14 22:53:18 |
|
|
int i, res, min_len; |
int i, res, min_len; |
char *cp, option[LINE_MAX]; |
char *cp, option[LINE_MAX]; |
int pipefds[2]; |
int pipefds[2]; |
|
pid_t child; |
|
|
min_len = (int) login_getcapnum(lc, "minpasswordlen", 6, 6); |
min_len = (int) login_getcapnum(lc, "minpasswordlen", 6, 6); |
if (min_len > 0 && strlen(password) < min_len) { |
if (min_len > 0 && strlen(password) < min_len) { |
|
|
goto out; |
goto out; |
} |
} |
|
|
res = fork(); |
child = fork(); |
if (res == 0) { |
if (child == 0) { |
char *argp[] = { "sh", "-c", NULL, NULL}; |
char *argp[] = { "sh", "-c", NULL, NULL}; |
|
|
/* Drop privileges */ |
/* Drop privileges */ |
|
|
if (execv(_PATH_BSHELL, argp) == -1) |
if (execv(_PATH_BSHELL, argp) == -1) |
exit(1); |
exit(1); |
/* NOT REACHED */ |
/* NOT REACHED */ |
} else if (res == -1) { |
} else if (child == -1) { |
warn("fork"); |
warn("fork"); |
goto out; |
goto out; |
} |
} |
|
|
close(pipefds[1]); |
close(pipefds[1]); |
|
|
/* get the return value from the child */ |
/* get the return value from the child */ |
wait(&res); |
wait(&child); |
if (WIFEXITED(res) && WEXITSTATUS(res) == 0) |
if (WIFEXITED(child) && WEXITSTATUS(child) == 0) |
return (1); |
return (1); |
|
|
out: |
out: |
|
|
} |
} |
|
|
int |
int |
pwd_gettries( struct passwd *pwd, login_cap_t *lc ) |
pwd_gettries(struct passwd *pwd, login_cap_t *lc) |
{ |
{ |
char option[LINE_MAX]; |
char option[LINE_MAX]; |
char *ep = option; |
char *ep = option; |