- run_shell ( tmp, 1, 0, 0); /* exec the shell finally. */
-
- return EXIT_FAILURE;
-}
-
-
-
-static int login_prompt ( char *buf_name )
-{
- char buf [1024];
- char *sp, *ep;
- int i;
-
- for(i=0; i<EMPTY_USERNAME_COUNT; i++) {
- print_login_prompt();
-
- if ( !fgets ( buf, sizeof( buf ) - 1, stdin ))
- return 0;
-
- if ( !strchr ( buf, '\n' ))
- return 0;
-
- for ( sp = buf; isspace ( *sp ); sp++ ) { }
- for ( ep = sp; isgraph ( *ep ); ep++ ) { }
-
- *ep = 0;
- safe_strncpy(buf_name, sp, USERNAME_SIZE);
- if(buf_name[0])
- return 1;
- }
- return 0;
-}
-
-
-static int check_nologin ( int amroot )
-{
- if ( access ( bb_path_nologin_file, F_OK ) == 0 ) {
- FILE *fp;
- int c;
-
- if (( fp = fopen ( bb_path_nologin_file, "r" ))) {
- while (( c = getc ( fp )) != EOF )
- putchar (( c == '\n' ) ? '\r' : c );
-
- fflush ( stdout );
- fclose ( fp );
- } else {
- puts ( "\r\nSystem closed for routine maintenance.\r" );
- }
- if ( !amroot )
- return 1;
-
- puts ( "\r\n[Disconnect bypassed -- root login allowed.]\r" );
- }
- return 0;
-}
-
-#ifdef CONFIG_FEATURE_SECURETTY
-
-static int check_tty ( const char *tty )
-{
- FILE *fp;
- int i;
- char buf[BUFSIZ];
-
- if (( fp = fopen ( bb_path_securetty_file, "r" ))) {
- while ( fgets ( buf, sizeof( buf ) - 1, fp )) {
- for ( i = bb_strlen( buf ) - 1; i >= 0; --i ) {
- if ( !isspace ( buf[i] ))
- break;
- }
- buf[++i] = '\0';
- if (( buf [0] == '\0' ) || ( buf [0] == '#' ))
- continue;
-
- if ( strcmp ( buf, tty ) == 0 ) {
- fclose ( fp );
- return 1;
- }
- }
- fclose(fp);
- return 0;
- }
- /* A missing securetty file is not an error. */
- return 1;
-}
-
-#endif
-
-/* returns 1 if true */
-static int is_my_tty ( const char *tty )
-{
- struct stat by_name, by_fd;
-
- if ( stat ( tty, &by_name ) || fstat ( 0, &by_fd ))
- return 0;
-
- if ( by_name. st_rdev != by_fd. st_rdev )
- return 0;
- else
- return 1;
-}
-