From 2d904266ec7e4292e63c6d539b2af9a9931ec1a9 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Fri, 2 Sep 2011 17:07:49 +0000 Subject: [PATCH] Add a loop_ prefix to net-server.c functions From npmccallum@redhat.com. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25128 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/net-server.h | 19 ++++++++++--------- src/kadmin/server/ovsec_kadmd.c | 14 +++++++------- src/kdc/main.c | 10 +++++----- src/lib/apputils/net-server.c | 23 ++++++++++++----------- 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/src/include/net-server.h b/src/include/net-server.h index 6902abf10..144156de0 100644 --- a/src/include/net-server.h +++ b/src/include/net-server.h @@ -37,14 +37,15 @@ typedef struct _krb5_fulladdr { /* exported from network.c */ extern volatile int signal_requests_exit, signal_requests_reset; void init_addr(krb5_fulladdr *, struct sockaddr *); -krb5_error_code add_udp_port(int port); -krb5_error_code add_tcp_port(int port); -krb5_error_code add_rpc_service(int port, u_long prognum, u_long versnum, - void (*dispatch)()); -krb5_error_code setup_network(void *handle, const char *prog, int no_reconfig); -krb5_error_code listen_and_process(void *handle, const char *prog, - void (*reset)(void)); -void closedown_network(void); +krb5_error_code loop_add_udp_port(int port); +krb5_error_code loop_add_tcp_port(int port); +krb5_error_code loop_add_rpc_service(int port, u_long prognum, u_long versnum, + void (*dispatch)()); +krb5_error_code loop_setup_network(void *handle, const char *prog, + int no_reconfig); +krb5_error_code loop_listen_and_process(void *handle, const char *prog, + void (*reset)(void)); +void loop_closedown_network(void); /* to be supplied by the server application */ @@ -55,7 +56,7 @@ void closedown_network(void); * The first, dispatch(), is for normal processing of a request. The * second, make_toolong_error(), is obviously for generating an error * to send back when the incoming message is bigger than - * listen_and_process can accept. + * loop_listen_and_process can accept. */ krb5_error_code dispatch (void *handle, struct sockaddr *local_addr, diff --git a/src/kadmin/server/ovsec_kadmd.c b/src/kadmin/server/ovsec_kadmd.c index 04d8c4b84..190297db9 100644 --- a/src/kadmin/server/ovsec_kadmd.c +++ b/src/kadmin/server/ovsec_kadmd.c @@ -379,19 +379,19 @@ int main(int argc, char *argv[]) } #define server_handle ((kadm5_server_handle_t)global_server_handle) - if ((ret = add_udp_port(server_handle->params.kpasswd_port)) - || (ret = add_tcp_port(server_handle->params.kpasswd_port)) - || (ret = add_rpc_service(server_handle->params.kadmind_port, + if ((ret = loop_add_udp_port(server_handle->params.kpasswd_port)) + || (ret = loop_add_tcp_port(server_handle->params.kpasswd_port)) + || (ret = loop_add_rpc_service(server_handle->params.kadmind_port, KADM, KADMVERS, kadm_1)) #ifndef DISABLE_IPROP || (server_handle->params.iprop_enabled - ? (ret = add_rpc_service(server_handle->params.iprop_port, + ? (ret = loop_add_rpc_service(server_handle->params.iprop_port, KRB5_IPROP_PROG, KRB5_IPROP_VERS, krb5_iprop_prog_1)) : 0) #endif #undef server_handle - || (ret = setup_network(global_server_handle, whoami, 0))) { + || (ret = loop_setup_network(global_server_handle, whoami, 0))) { const char *e_txt = krb5_get_error_message (context, ret); krb5_klog_syslog(LOG_ERR, _("%s: %s while initializing network, " "aborting"), whoami, e_txt); @@ -626,13 +626,13 @@ kterr: if (nofork) fprintf(stderr, _("%s: starting...\n"), whoami); - listen_and_process(global_server_handle, whoami, reset_db); + loop_listen_and_process(global_server_handle, whoami, reset_db); krb5_klog_syslog(LOG_INFO, _("finished, exiting")); /* Clean up memory, etc */ svcauth_gssapi_unset_names(); kadm5_destroy(global_server_handle); - closedown_network(); + loop_closedown_network(); kadm5int_acl_finish(context, 0); if(gss_changepw_name) { (void) gss_release_name(&OMret, &gss_changepw_name); diff --git a/src/kdc/main.c b/src/kdc/main.c index cc89fabe3..a6a575166 100644 --- a/src/kdc/main.c +++ b/src/kdc/main.c @@ -1013,7 +1013,7 @@ int main(int argc, char **argv) port = strtol(cp, &cp, 10); if (cp == 0) break; - retval = add_udp_port(port); + retval = loop_add_udp_port(port); if (retval) goto net_init_error; } @@ -1027,7 +1027,7 @@ int main(int argc, char **argv) port = strtol(cp, &cp, 10); if (cp == 0) break; - retval = add_tcp_port(port); + retval = loop_add_tcp_port(port); if (retval) goto net_init_error; } @@ -1039,7 +1039,7 @@ int main(int argc, char **argv) * children won't be able to re-open the listener sockets. Hopefully our * platform has pktinfo support and doesn't need reconfigs. */ - if ((retval = setup_network(NULL, kdc_progname, (workers > 0)))) { + if ((retval = loop_setup_network(NULL, kdc_progname, (workers > 0)))) { net_init_error: kdc_err(kcontext, retval, _("while initializing network")); finish_realms(); @@ -1071,11 +1071,11 @@ int main(int argc, char **argv) krb5_klog_syslog(LOG_INFO, _("commencing operation")); if (nofork) fprintf(stderr, _("%s: starting...\n"), kdc_progname); - if ((retval = listen_and_process(0, kdc_progname, reset_for_hangup))) { + if ((retval = loop_listen_and_process(0, kdc_progname, reset_for_hangup))) { kdc_err(kcontext, retval, _("while processing network requests")); errout++; } - closedown_network(); + loop_closedown_network(); krb5_klog_syslog(LOG_INFO, _("shutting down")); unload_preauth_plugins(kcontext); unload_authdata_plugins(kcontext); diff --git a/src/lib/apputils/net-server.c b/src/lib/apputils/net-server.c index a1bbaa559..5afc3c0fa 100644 --- a/src/lib/apputils/net-server.c +++ b/src/lib/apputils/net-server.c @@ -64,7 +64,7 @@ volatile int signal_requests_exit = 0, signal_requests_reset = 0; -static void closedown_network_sockets(void); +static void loop_closedown_network_sockets(void); /* Misc utility routines. */ static void @@ -279,7 +279,7 @@ static struct select_state sstate; static fd_set rpc_listenfds; krb5_error_code -add_udp_port(int port) +loop_add_udp_port(int port) { int i; void *tmp; @@ -298,7 +298,7 @@ add_udp_port(int port) } krb5_error_code -add_tcp_port(int port) +loop_add_tcp_port(int port) { int i; void *tmp; @@ -317,7 +317,8 @@ add_tcp_port(int port) } krb5_error_code -add_rpc_service(int port, u_long prognum, u_long versnum, void (*dispatchfn)()) +loop_add_rpc_service(int port, u_long prognum, + u_long versnum, void (*dispatchfn)()) { int i; void *tmp; @@ -1092,7 +1093,7 @@ extern int krb5int_debug_sendto_kdc; extern void (*krb5int_sendtokdc_debug_handler)(const void*, size_t); krb5_error_code -setup_network(void *handle, const char *prog, int no_reconfig) +loop_setup_network(void *handle, const char *prog, int no_reconfig) { struct socksetup setup_data; @@ -1798,7 +1799,7 @@ getcurtime(struct timeval *tvp) } krb5_error_code -listen_and_process(void *handle, const char *prog, void (*reset)(void)) +loop_listen_and_process(void *handle, const char *prog, void (*reset)(void)) { int nfound; /* This struct contains 3 fd_set objects; on some platforms, they @@ -1845,8 +1846,8 @@ listen_and_process(void *handle, const char *prog, void (*reset)(void)) } if (sret == 0 && netchanged) { network_reconfiguration_needed = 0; - closedown_network_sockets(); - err = setup_network(handle, prog, 0); + loop_closedown_network_sockets(); + err = loop_setup_network(handle, prog, 0); if (err) { com_err(prog, err, _("while reinitializing network")); return err; @@ -1878,7 +1879,7 @@ listen_and_process(void *handle, const char *prog, void (*reset)(void)) } static void -closedown_network_sockets() +loop_closedown_network_sockets() { int i; struct connection *conn; @@ -1914,9 +1915,9 @@ closedown_network_sockets() } void -closedown_network() +loop_closedown_network() { - closedown_network_sockets(); + loop_closedown_network_sockets(); FREE_SET_DATA(connections); FREE_SET_DATA(udp_port_data); FREE_SET_DATA(tcp_port_data); -- 2.26.2