X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=src%2Fauth.c;h=b4cf968d5e187b1b1c8b304ab77103193ba23408;hb=7e47c451d988dc11ede64c0860da8f171eda4998;hp=e201b8e8e1ce2ac2272cdfa91189c24c031c19fa;hpb=16204dfc7715783c2ebdfb55fc44fb9344613a76;p=ap-utils.git diff --git a/src/auth.c b/src/auth.c index e201b8e..b4cf968 100644 --- a/src/auth.c +++ b/src/auth.c @@ -38,12 +38,12 @@ #define RADIUS_IP _("[I] Radius server IP: ") #define RADIUS_DEST_PORT _("[P] Radius server port: ") #define RADIUS_SECRET _("[S] Radius server secret: ") -#define RADIUS_TIME _("[T] Reauthorization time (sec): ") +#define RADIUS_TIME _("[T] Reauthorization time (minutes): ") #define RADIUS_PORT _("[F] Radius source port: ") #define RADIUS_HELP _("A: auth; N: new; D: del; IPSTF: set; arrows: scroll; W: write conf; Q: quit") #define DOT1X_MODE _("[M] 802.1x authorization: ") -#define DOT1X_TIME _("[T] key broadcasting time period (sec): ") +#define DOT1X_TIME _("[T] key broadcasting time period (seconds): ") #define DOT1X_IP _("[I] 802.1x auth. server IP: ") #define DOT1X_SECRET _("[S] 802.1x auth. server secret: ") #define DOT1X_HELP _("A: auth; N: new; D: del; MTIS: set; arrows: scroll; W: write conf; Q: quit") @@ -221,21 +221,27 @@ void atmel_auth() sprintf(message, "%s%s", RADIUS_IP, inet_ntoa(ea_ip)); mvwaddstr(main_sub, 1, 0, message); - memcpy(&ea_dest_port, varbinds[4].value, 2); - ea_dest_port = ntohs(ea_dest_port); + ea_dest_port = varbinds[4].len_val == 2 ? + (varbinds[4].value[0] << 8) | varbinds[4].value[1] : + varbinds[4].value[0] < 0x80 ? + varbinds[4].value[0] : 0xff00 | varbinds[4].value[0]; sprintf(message, "%s%d", RADIUS_DEST_PORT, ea_dest_port); mvwaddstr(main_sub, 2, 0, message); sprintf(message, "%s%s", RADIUS_SECRET, ea_secret); mvwaddstr(main_sub, 3, 0, message); - memcpy(&ea_time, varbinds[3].value, 2); - ea_time = ntohs(ea_time); + ea_time = varbinds[3].len_val == 2 ? + (varbinds[3].value[0] << 8) | varbinds[3].value[1] : + varbinds[3].value[0] < 0x80 ? + varbinds[3].value[0] : 0xff00 | varbinds[3].value[0]; sprintf(message, "%s%d", RADIUS_TIME, ea_time); mvwaddstr(main_sub, 4, 0, message); - memcpy(&ea_port, varbinds[2].value, 2); - ea_port = ntohs(ea_port); + ea_port = varbinds[2].len_val == 2 ? + (varbinds[2].value[0] << 8) | varbinds[2].value[1] : + varbinds[2].value[0] < 0x80 ? + varbinds[2].value[0] : 0xff00 | varbinds[2].value[0]; sprintf(message, "%s%d", RADIUS_PORT, ea_port); mvwaddstr(main_sub, 5, 0, message); } @@ -715,6 +721,11 @@ again: print_helperr(ERR_SET); goto exit; } + wbkgd(main_sub, A_NORMAL); + wattrset(main_sub, COLOR_PAIR(13)); + mvwaddstr(main_sub, 8, 0, MAC_HEADER); + wattrset(main_sub, A_NORMAL); + wrefresh(main_sub); print_help(DONE_SET); goto exit; case KEY_DOWN: @@ -805,7 +816,7 @@ void nwn_auth_mac() varbind varbinds[3]; print_top(NULL, AUTH_TITLE); - mvwaddstr(main_sub, 2, 5, MAC_HEADER); + mvwaddstr(main_sub, 2, 0, MAC_HEADER); wrefresh(main_sub); print_help(WAIT_RET); @@ -1049,6 +1060,8 @@ void nwn_auth_mac() curr = curr->next; i++; } + wbkgd(main_sub, A_NORMAL); + wrefresh(main_sub); print_help(DONE_SET); goto exit; case KEY_DOWN: