Beispiel #1
0
static int
passwd_test_getpwuid(struct passwd *pwd_model, void *mdata)
{
	struct passwd *pwd;

#ifdef DEBUG
	printf("testing getpwuid() with the following data...\n");
	dump_passwd(pwd_model);
#endif

	pwd = getpwuid(pwd_model->pw_uid);
	if ((passwd_test_correctness(pwd, NULL) != 0) ||
	    ((compare_passwd(pwd, pwd_model, NULL) != 0) &&
	    (passwd_check_ambiguity((struct passwd_test_data *)mdata, pwd)
	    != 0))) {
#ifdef DEBUG
		printf("not ok\n");
#endif
		return (-1);
	} else {
#ifdef DEBUG
		printf("ok\n");
#endif
		return (0);
	}
}
Beispiel #2
0
void sighup_run(void)
{
    sighup_flag = 0;
    time(&current_time);
    log_error_time();
    fputs("caught SIGHUP, restarting\n", stderr);

    /* Philosophy change for 0.92: don't close and attempt reopen of logfiles,
     * since usual permission structure prevents such reopening.
     */

    FD_ZERO(&block_read_fdset);
    FD_ZERO(&block_write_fdset);
    /* clear_common_env(); NEVER DO THIS */
    dump_mime();
    dump_passwd();
    dump_alias();
    free_requests();

    log_error_time();
    fputs("re-reading configuration files\n", stderr);
    read_config_files();

    log_error_time();
    fputs("successful restart\n", stderr);

}
Beispiel #3
0
static int
passwd_test_getpwnam(struct passwd *pwd_model, void *mdata)
{
	struct passwd *pwd;

#ifdef DEBUG
	printf("testing getpwnam() with the following data:\n");
	dump_passwd(pwd_model);
#endif

	pwd = getpwnam(pwd_model->pw_name);
	if (passwd_test_correctness(pwd, NULL) != 0)
		goto errfin;

	if ((compare_passwd(pwd, pwd_model, NULL) != 0) &&
	    (passwd_check_ambiguity((struct passwd_test_data *)mdata, pwd)
	    !=0))
	    goto errfin;

#ifdef DEBUG
	printf("ok\n");
#endif
	return (0);

errfin:
#ifdef DEBUG
	printf("not ok\n");
#endif
	return (-1);
}
Beispiel #4
0
void sigterm_stage2_run() /* lame duck mode */
{
    log_error_time();
    fprintf(stderr,
            "exiting Boa normally (uptime %d seconds)\n",
            (int) (current_time - start_time));
    chdir(tempdir);
    clear_common_env();
    dump_mime();
    dump_passwd();
    dump_alias();
    free_requests();
    exit(0);
}
Beispiel #5
0
void sigterm_stage2_run() /* lame duck mode */
{
    log_error_time();
    fprintf(stderr,
            "exiting Boa normally (uptime %d seconds)\n",
            (int) (current_time - start_time));
    chdir(tempdir);
    clear_common_env();
    dump_mime();
    dump_passwd();
    dump_alias();
    free_requests();
#if  defined(TCSUPPORT_WEBSERVER_SSL)
    boa_sslUninit();
#endif
    exit(0);
}
Beispiel #6
0
void sigterm_stage2_run() /* lame duck mode */
{
	int ret=0;
	log_error_time();
	fprintf(stderr,
			"exiting Boa normally (uptime %d seconds)\n",
			(int) (current_time - start_time));
	ret= chdir(tempdir);
	if(ret<0)
	{
		fprintf(stderr,"chdir  faile %s:%d\n",__FILE__,__LINE__);
	}
	clear_common_env();
	dump_mime();
	dump_passwd();
	dump_alias();
	free_requests();
	exit(0);
}
Beispiel #7
0
Datei: signals.c Projekt: gpg/boa
void sigterm_stage2_run(void)
{                               /* lame duck mode */
    log_error_time();
    fprintf(stderr,
            "exiting Boa normally (uptime %d seconds)\n",
            (int) (current_time - start_time));
    if (chdir(tempdir) == -1)
      perror ("chdir (tempdir) failed");
    clear_common_env();
    dump_mime();
    dump_passwd();
    dump_alias();
    free_requests();
    range_pool_empty();
    free(server_root);
    free(server_name);
    server_root = NULL;
    exit(EXIT_SUCCESS);
}
Beispiel #8
0
static int
passwd_test_correctness(struct passwd *pwd, void *mdata)
{

#ifdef DEBUG
	printf("testing correctness with the following data:\n");
	dump_passwd(pwd);
#endif

	if (pwd == NULL)
		return (-1);

	if (pwd->pw_name == NULL)
		goto errfin;

	if (pwd->pw_passwd == NULL)
		goto errfin;

	if (pwd->pw_class == NULL)
		goto errfin;

	if (pwd->pw_gecos == NULL)
		goto errfin;

	if (pwd->pw_dir == NULL)
		goto errfin;

	if (pwd->pw_shell == NULL)
		goto errfin;

#ifdef DEBUG
	printf("correct\n");
#endif

	return (0);
errfin:
#ifdef DEBUG
	printf("incorrect\n");
#endif

	return (-1);
}