int trq_main( int argc, char **argv, char **envp) { int rc = PBSE_NONE; char *trq_server_ip = NULL; char *the_key = NULL; char *sign_key = NULL; int trq_server_port = 0; int daemon_port = 0; void *(*process_method)(void *) = process_svr_conn; if (IamRoot() == 0) { printf("This program must be run as root!!!\n"); return(PBSE_IVALREQ); } parse_command_line(argc, argv); if ((rc = load_config(&trq_server_ip, &trq_server_port, &daemon_port)) != PBSE_NONE) { } else if ((rc = load_ssh_key(&the_key)) != PBSE_NONE) { } else if ((validate_server(trq_server_ip, trq_server_port, the_key, &sign_key)) != PBSE_NONE) { } else if ((rc = daemonize_trqauthd(AUTH_IP, daemon_port, process_method)) == PBSE_NONE) { } else { printf("Daemon exit requested\n"); } if (the_key != NULL) free(the_key); return rc; }
int trq_main( int argc, char **argv, char ** UNUSED(envp)) { int rc = PBSE_NONE; char *the_key = NULL; char *sign_key = NULL; int trq_server_port = 0; char *daemon_port = NULL; void *(*process_method)(void *) = process_svr_conn; parse_command_line(argc, argv); if (IamRoot() == 0) { printf("This program must be run as root!!!\n"); return(PBSE_IVALREQ); } rc = set_trqauthd_addr(); if (rc != PBSE_NONE) return(rc); if (down_server == true) { rc = terminate_trqauthd(); return(rc); } if ((rc = load_trqauthd_config(&active_pbs_server, &trq_server_port, &daemon_port)) != PBSE_NONE) { fprintf(stderr, "Failed to load configuration. Make sure the $TORQUE_HOME/server_name file exists\n"); } else if ((rc = check_trqauthd_unix_domain_port(daemon_port)) != PBSE_NONE) { fprintf(stderr, "trqauthd unix domain file %s already bound.\n trqauthd may already be running \n", daemon_port); } else if ((rc = load_ssh_key(&the_key)) != PBSE_NONE) { } else if ((rc = init_trqauth_log(daemon_port)) != PBSE_NONE) { fprintf(stderr, "ERROR: Failed to initialize trqauthd log\n"); } else if ((rc = validate_server(active_pbs_server, trq_server_port, the_key, &sign_key)) != PBSE_NONE) { } else if ((rc = daemonize_trqauthd(AUTH_IP, daemon_port, process_method)) == PBSE_NONE) { } else { printf("Daemon exit requested\n"); } if (the_key != NULL) free(the_key); if (daemon_port != NULL) free(daemon_port); return rc; }