static int nameadd(const char *name) { _char **entry; int type; if(!name) abort(); name_list.data=kore_realloc(name_list.data, (name_list.len+1)*sizeof *name_list.data); type=name_list.len; entry=name_list.data+type; name_list.len++; *entry=(_char*)kore_strdup((const char*)name); return type; }
static int configure_pidfile(char **argv) { if (argv[1] == NULL) return (KORE_RESULT_ERROR); if (strcmp(kore_pidfile, KORE_PIDFILE_DEFAULT)) { kore_debug("duplicate pidfile directive specified"); return (KORE_RESULT_ERROR); } kore_pidfile = kore_strdup(argv[1]); return (KORE_RESULT_OK); }
static int configure_runas(char **argv) { if (runas_user != NULL) { kore_debug("duplicate runas user specified"); return (KORE_RESULT_ERROR); } if (argv[1] == NULL) return (KORE_RESULT_ERROR); runas_user = kore_strdup(argv[1]); return (KORE_RESULT_OK); }
static int configure_chroot(char **argv) { if (chroot_path != NULL) { kore_debug("duplicate chroot path specified"); return (KORE_RESULT_ERROR); } if (argv[1] == NULL) return (KORE_RESULT_ERROR); chroot_path = kore_strdup(argv[1]); return (KORE_RESULT_OK); }
static int configure_ssl_cipher(char **argv) { if (argv[1] == NULL) return (KORE_RESULT_ERROR); if (strcmp(kore_ssl_cipher_list, KORE_DEFAULT_CIPHER_LIST)) { kore_debug("duplicate ssl_cipher directive specified"); return (KORE_RESULT_ERROR); } kore_ssl_cipher_list = kore_strdup(argv[1]); return (KORE_RESULT_OK); }
static int configure_onload(char **argv) { if (argv[1] == NULL) return (KORE_RESULT_ERROR); if (kore_module_onload != NULL) { kore_debug("duplicate onload directive found"); return (KORE_RESULT_ERROR); } kore_module_onload = kore_strdup(argv[1]); return (KORE_RESULT_OK); }
void kore_pool_init(struct kore_pool *pool, const char *name, u_int32_t len, u_int32_t elm) { kore_debug("kore_pool_init(%p, %s, %d, %d)", pool, name, len, elm); pool->elms = 0; pool->inuse = 0; pool->elen = len; pool->name = kore_strdup(name); pool->slen = pool->elen + sizeof(struct kore_pool_entry); LIST_INIT(&(pool->regions)); LIST_INIT(&(pool->freelist)); pool_region_create(pool, elm); }
static int configure_certkey(char **argv) { if (argv[1] == NULL) return (KORE_RESULT_ERROR); if (current_domain == NULL) { kore_debug("missing domain for certkey"); return (KORE_RESULT_ERROR); } if (current_domain->certkey != NULL) { kore_debug("domain already has a certkey set"); return (KORE_RESULT_ERROR); } current_domain->certkey = kore_strdup(argv[1]); return (KORE_RESULT_OK); }
static int configure_bind(char **argv) { int err; if (argv[1] == NULL || argv[2] == NULL) return (KORE_RESULT_ERROR); if (server_ip != NULL || server_port != 0) { kore_debug("duplicate bind directive seen"); return (KORE_RESULT_ERROR); } server_ip = kore_strdup(argv[1]); server_port = kore_strtonum(argv[2], 1, 65535, &err); if (err != KORE_RESULT_OK) { kore_debug("%s is an invalid port number", argv[2]); return (KORE_RESULT_ERROR); } return (KORE_RESULT_OK); }