# include <selinux/get_context_list.h>
#endif
-#define F_PASSWD "/etc/passwd"
-#define F_SHADOW "/etc/shadow"
-#define BINSH "/bin/sh"
+#include "pathnames.h"
static int timeout;
static int profile;
pwd.pw_uid = 0;
pwd.pw_gid = 0;
- if ((fp = fopen(F_PASSWD, "r")) == NULL) {
- perror(F_PASSWD);
+ if ((fp = fopen(_PATH_PASSWD, "r")) == NULL) {
+ perror(_PATH_PASSWD);
return &pwd;
}
* or not found, return.
*/
if (p == NULL) {
- fprintf(stderr, "%s: no entry for root\n", F_PASSWD);
+ fprintf(stderr, "%s: no entry for root\n", _PATH_PASSWD);
return &pwd;
}
if (valid(pwd.pw_passwd))
* shadow password, try it.
*/
strcpy(pwd.pw_passwd, "");
- if ((fp = fopen(F_SHADOW, "r")) == NULL) {
- fprintf(stderr, "%s: root password garbled\n", F_PASSWD);
+ if ((fp = fopen(_PATH_SHADOW_PASSWD, "r")) == NULL) {
+ fprintf(stderr, "%s: root password garbled\n", _PATH_PASSWD);
return &pwd;
}
while ((p = fgets(sline, 256, fp)) != NULL) {
* NULL it, and return.
*/
if (p == NULL) {
- fprintf(stderr, "%s: no entry for root\n", F_SHADOW);
+ fprintf(stderr, "%s: no entry for root\n", _PATH_SHADOW_PASSWD);
strcpy(pwd.pw_passwd, "");
}
if (!valid(pwd.pw_passwd)) {
- fprintf(stderr, "%s: root password garbled\n", F_SHADOW);
+ fprintf(stderr, "%s: root password garbled\n", _PATH_SHADOW_PASSWD);
strcpy(pwd.pw_passwd, "");
}
return &pwd;
if (pwd->pw_shell[0])
sushell = pwd->pw_shell;
else
- sushell = BINSH;
+ sushell = "/bin/sh";
}
if ((p = strrchr(sushell, '/')) == NULL)
p = sushell;
execl(sushell, shell, NULL);
perror(sushell);
- setenv("SHELL", BINSH, 1);
- execl(BINSH, profile ? "-sh" : "sh", NULL);
- perror(BINSH);
+ setenv("SHELL", "/bin/sh", 1);
+ execl("/bin/sh", profile ? "-sh" : "sh", NULL);
+ perror("/bin/sh");
}
static void usage(void)