Repaired the problem of a blank network node being
authorArt Cancro <ajc@citadel.org>
Mon, 3 Sep 2007 04:20:16 +0000 (04:20 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 3 Sep 2007 04:20:16 +0000 (04:20 +0000)
added the first time one attempts to configure networking.  Also
set the default port number to 504.

webcit/netconf.c
webcit/webcit.c
webcit/webcit.h

index a1498692f216d6eadbe371caabcb3806cef09a5c..1dde529ba8bcc0e4959741412be7be7fd8761ccc 100644 (file)
@@ -31,24 +31,28 @@ void edit_node(void) {
                                                fprintf(fp, "%s\n", buf);
                                        }
                                }
-                       fprintf(fp, "%s|%s|%s|%s\n", 
-                               bstr("node"),
-                               bstr("secret"),
-                               bstr("host"),
-                               bstr("port") );
-                       }
                        rewind(fp);
+               }
 
-                       serv_puts("CONF putsys|application/x-citadel-ignet-config");
-                       serv_getln(buf, sizeof buf);
-                       if (buf[0] == '4') {
+               serv_puts("CONF putsys|application/x-citadel-ignet-config");
+               serv_getln(buf, sizeof buf);
+               if (buf[0] == '4') {
+                       if (fp != NULL) {
                                while (fgets(buf, sizeof buf, fp) != NULL) {
                                        buf[strlen(buf)-1] = 0;
-                                       serv_puts(buf);
+                                       if (buf[0] != 0) {
+                                               serv_puts(buf);
+                                       }
                                }
-                               serv_puts("000");
+                               fclose(fp);
+                       }
+                       serv_printf("%s|%s|%s|%s", 
+                               bstr("node"),
+                               bstr("secret"),
+                               bstr("host"),
+                               bstr("port") );
                        }
-                       fclose(fp);
+                       serv_puts("000");
                }
        }
 
@@ -80,7 +84,7 @@ void display_add_node(void)
        wprintf("<TR><TD>%s</TD>", _("Host or IP address"));
        wprintf("<TD><INPUT TYPE=\"text\" NAME=\"host\" MAXLENGTH=\"64\"></TD></TR>\n");
        wprintf("<TR><TD>%s</TD>", _("Port number"));
-       wprintf("<TD><INPUT TYPE=\"text\" NAME=\"port\" MAXLENGTH=\"8\"></TD></TR>\n");
+       wprintf("<TD><INPUT TYPE=\"text\" NAME=\"port\" VALUE=\"504\" MAXLENGTH=\"8\"></TD></TR>\n");
        wprintf("</TABLE><br />");
                wprintf("<INPUT TYPE=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Add node"));
        wprintf("&nbsp;");
@@ -290,33 +294,5 @@ void delete_node(void)
        display_netconf();
 }
 
-/**
- * \brief add a new node
- */
-void add_node(void)
-{
-       char node[SIZ];
-       char buf[SIZ];
-
-       strcpy(node, bstr("node"));
-
-       if (!IsEmptyStr(bstr("add_button")))  {
-               sprintf(buf, "NSET addnode|%s", node);
-               serv_puts(buf);
-               serv_getln(buf, sizeof buf);
-               if (buf[0] == '1') {
-                       output_headers(1, 1, 0, 0, 0, 0);
-                       server_to_text();
-                       wprintf("<a href=\"display_netconf\">");
-                       wprintf(_("Back to menu"));
-                       wprintf("</A>\n");
-                       wDumpContent(1);
-               } else {
-                       strcpy(WC->ImportantMessage, &buf[4]);
-                       display_netconf();
-               }
-       }
-}
-
 
 /*@}*/
index f81a5d4e91373d4cc9b14a053cc8251324a1fc18..865c8b78518d015294075cb489748cb8d4acda17 100644 (file)
@@ -1646,8 +1646,6 @@ void session_loop(struct httprequest *req)
                delete_node();
        } else if (!strcasecmp(action, "display_add_node")) {
                display_add_node();
-       } else if (!strcasecmp(action, "add_node")) {
-               add_node();
        } else if (!strcasecmp(action, "terminate_session")) {
                slrp_highest();
                terminate_session();
index 3068770abf922e93105ddfe84533c08eac6cebf7..1fff20e76a79f0ddb8b959e2dc19235f16b5f971 100644 (file)
@@ -556,7 +556,6 @@ void display_netconf(void);
 void display_confirm_delete_node(void);
 void delete_node(void);
 void display_add_node(void);
-void add_node(void);
 void terminate_session(void);
 void edit_me(void);
 void display_siteconfig(void);