if (geteuid() == 0 && config->uid == 0) { fprintf(stderr, "running uoamhub as root is a Bad Thing(TM), please use --user\n"); exit(1); }
static void read_config(struct config *config, int argc, char **argv) {    int ret;    struct addrinfo hints;    static const struct option long_options[] = {        {"version", 0, 0, 'V'},        {"verbose", 0, 0, 'v'},        {"quiet", 0, 0, 'q'},        {"help", 0, 0, 'h'},        {"port", 1, 0, 'p'},        {"chroot", 1, 0, 'r'},        {"user", 1, 0, 'u'},        {"logger", 1, 0, 'l'},        {"pidfile", 1, 0, 'P'},        {0,0,0,0}    };    unsigned port = 2000;    struct passwd *pw;    memset(config, 0, sizeof(*config));    while (1) {        int option_index = 0;        ret = getopt_long(argc, argv, "Vvqhp:r:u:Dl:",                          long_options, &option_index);        if (ret == -1)            break;        switch (ret) {        case 'V':            printf("uoamhub v%s\n", VERSION);            exit(0);        case 'v':            verbose++;            break;        case 'q':            verbose = 0;            break;        case 'h':            usage();        case 'p':            port = (unsigned)strtoul(optarg, NULL, 10);            if (port == 0) {                fprintf(stderr, "invalid port specification\n");                exit(1);            }            break;        case 'D':            config->no_daemon = 1;            break;        case 'P':            config->pidfile = optarg;            break;        case 'l':            config->logger = optarg;            break;        case 'r':            config->chroot_dir = *optarg == 0                ? NULL : optarg;            break;        case 'u':            pw = getpwnam(optarg);            if (pw == NULL) {                fprintf(stderr, "user '%s' not found\n", optarg);                exit(1);            }            if (pw->pw_uid == 0) {                fprintf(stderr, "setuid root is not allowed\n");                exit(1);            }            config->uid = pw->pw_uid;            config->gid = pw->pw_gid;            break;        default:            exit(1);        }    }    if (optind < argc) {        fprintf(stderr, "unrecognized argument: %s\n", argv[optind]);        usage();    }    memset(&hints, 0, sizeof(hints));    hints.ai_family = PF_INET;    hints.ai_socktype = SOCK_STREAM;    ret = getaddrinfo_helper("*", port, &hints, &config->bind_address);    if (ret < 0) {        fprintf(stderr, "getaddrinfo_helper failed: %s\n",                strerror(errno));        exit(1);    }}