]> git.decadent.org.uk Git - ap-utils.git/blobdiff - lib/set_community.c
Imported Upstream version 1.5~pre1
[ap-utils.git] / lib / set_community.c
index d7fc47dab81892a462c6009de144dd9637f3cff2..84e7c7380474a405146d719f93debf1a18c5e747 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include "ap-utils.h"
-#include "ap-curses.h"
 
 #define COMMUNITY_TOP_HEADER _("Set community/password")
 #define COMMUNITY_HEADER1 _("Key Access level")
 #define COMMUNITY_HEADER2 _("Community/Password")
-#define COMMUNITY_USER  _("[U] User")
-#define COMMUNITY_ADMIN  _("[A] Administrator")
+#define COMMUNITY_USER  _("[U] User ")
+#define COMMUNITY_ADMIN  _("[A] Administrator ")
+#define COMMUNITY_MANUF  _("[M] Manufacturer ")
 #define COMMUNITY_HELP _("[key] - set community/password; W - write config to AP; Q - quit to menu")
 
 extern WINDOW *main_sub;
@@ -37,13 +37,12 @@ extern short ap_type;
 
 void AuthorizedSettings()
 {
-
     char AuthorizedUserPass[3][12] = {
        {0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x01, 0x09, 0x01,
         0x00},
        {0x2B, 0x06, 0x01, 0x04, 0x01, 0x87, 0x29, 0x02, 0x01, 0x02, 0x01,
         0x00},
-       {0x2B, 0x06, 0x01, 0x04, 0x01, 0xe0, 0x3e, 0x01, 0x01, 0x09, 0x01,
+       {0x2B, 0x06, 0x01, 0x04, 0x01, 0xE0, 0x3E, 0x01, 0x01, 0x09, 0x01,
         0x00}
     };
     char AuthorizedAdminPass[3][12] = {
@@ -51,7 +50,7 @@ void AuthorizedSettings()
         0x00},
        {0x2B, 0x06, 0x01, 0x04, 0x01, 0x87, 0x29, 0x02, 0x01, 0x02, 0x02,
         0x00},
-        {0x2B, 0x06, 0x01, 0x04, 0x01, 0xe0, 0x3e, 0x01, 0x01, 0x09, 0x02,
+        {0x2B, 0x06, 0x01, 0x04, 0x01, 0xE0, 0x3E, 0x01, 0x01, 0x09, 0x02,
          0x00}
     };
     char AuthorizedManufactPass[] =
@@ -69,7 +68,7 @@ void AuthorizedSettings()
     }
 
     user[0] = admin[0] = manufact[0] = '\0';
-    print_title(COMMUNITY_TOP_HEADER);
+    print_top(NULL, COMMUNITY_TOP_HEADER);
 
     mvwaddstr(main_sub, 0, 0, COMMUNITY_HEADER1);
     mvwaddstr(main_sub, 0, 25, COMMUNITY_HEADER2);
@@ -77,7 +76,7 @@ void AuthorizedSettings()
     mvwaddstr(main_sub, 2, 0, COMMUNITY_ADMIN);
 
     if (ap_type == ATMEL410 || ap_type == ATMEL12350) {
-       mvwaddstr(main_sub, 3, 0, _("[M] Manufacturer"));
+       mvwaddstr(main_sub, 3, 0, COMMUNITY_MANUF);
     }
     wrefresh(main_sub);
 
@@ -90,12 +89,12 @@ void AuthorizedSettings()
        case 'U':
        case 'u':
 /*         get_value(user, 1, 25, sizeof(user), ANY_STRING, 0, 0, NULL); */
-           get_pass(user, 1, 25, sizeof(user));
+           get_pass(user, 1, strlen(COMMUNITY_USER), sizeof(user));
            continue;
        case 'A':
        case 'a':
 /*         get_value(admin, 2, 25, sizeof(admin), ANY_STRING, 0, 0, NULL); */
-           get_pass(admin, 2, 25, sizeof(admin));
+           get_pass(admin, 2, strlen(COMMUNITY_ADMIN), sizeof(admin));
            continue;
        case 'M':
        case 'm':
@@ -104,7 +103,8 @@ void AuthorizedSettings()
                get_value(manufact, 3, 25, sizeof(manufact), ANY_STRING,
                    0, 0, NULL);
 */
-               get_pass(manufact, 3, 25, sizeof(manufact));
+               get_pass(manufact, 3, strlen(COMMUNITY_MANUF),
+                   sizeof(manufact));
            continue;
        case 'Q':
        case 'q':
@@ -151,6 +151,6 @@ void AuthorizedSettings()
     getch();
   quit:
     print_help("");
-    print_title("");
+    print_top(NULL, NULL);
     clear_main(0);
 }