Add a loop_ prefix to net-server.c functions
authorGreg Hudson <ghudson@mit.edu>
Fri, 2 Sep 2011 17:07:49 +0000 (17:07 +0000)
committerGreg Hudson <ghudson@mit.edu>
Fri, 2 Sep 2011 17:07:49 +0000 (17:07 +0000)
From npmccallum@redhat.com.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25128 dc483132-0cff-0310-8789-dd5450dbe970

src/include/net-server.h
src/kadmin/server/ovsec_kadmd.c
src/kdc/main.c
src/lib/apputils/net-server.c

index 6902abf10eacc3d24a527d3ee603785fc25160f3..144156de000a17739a640d8f54e64a43c7c689f3 100644 (file)
@@ -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,
index 04d8c4b841575201dab7fbd2851813a60eea0160..190297db94e63cfddf36afbde1db0047466b83aa 100644 (file)
@@ -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);
index cc89fabe3d602000e105cd87ea21e2d1ad0ad8b9..a6a5751660bd86902ba40f37947a81162f01f602 100644 (file)
@@ -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);
index a1bbaa559e4080d0f8d932fb2cc1374b143c3de8..5afc3c0fa0bba295d15ae87d4d143688e6fe8902 100644 (file)
@@ -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);