412
414
if (ssid->proto & WPA_PROTO_WPA) {
413
pos += snprintf(pos, end - pos, "%sWPA", first ? "" : " ");
415
ret = snprintf(pos, end - pos, "%sWPA", first ? "" : " ");
416
if (ret < 0 || ret >= end - pos)
417
422
if (ssid->proto & WPA_PROTO_RSN) {
418
pos += snprintf(pos, end - pos, "%sRSN", first ? "" : " ");
423
ret = snprintf(pos, end - pos, "%sRSN", first ? "" : " ");
424
if (ret < 0 || ret >= end - pos)
483
491
struct wpa_ssid *ssid)
485
493
char *buf, *pos, *end;
487
496
pos = buf = wpa_zalloc(50);
492
if (ssid->key_mgmt & WPA_KEY_MGMT_PSK)
493
pos += snprintf(pos, end - pos, "%sWPA-PSK",
494
pos == buf ? "" : " ");
496
if (ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X)
497
pos += snprintf(pos, end - pos, "%sWPA-EAP",
498
pos == buf ? "" : " ");
500
if (ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA)
501
pos += snprintf(pos, end - pos, "%sIEEE8021X",
502
pos == buf ? "" : " ");
504
if (ssid->key_mgmt & WPA_KEY_MGMT_NONE)
505
pos += snprintf(pos, end - pos, "%sNONE",
506
pos == buf ? "" : " ");
508
if (ssid->key_mgmt & WPA_KEY_MGMT_WPA_NONE)
509
pos += snprintf(pos, end - pos, "%sWPA-NONE",
510
pos == buf ? "" : " ");
501
if (ssid->key_mgmt & WPA_KEY_MGMT_PSK) {
502
ret = snprintf(pos, end - pos, "%sWPA-PSK",
503
pos == buf ? "" : " ");
504
if (ret < 0 || ret >= end - pos) {
511
if (ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X) {
512
ret = snprintf(pos, end - pos, "%sWPA-EAP",
513
pos == buf ? "" : " ");
514
if (ret < 0 || ret >= end - pos) {
521
if (ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA) {
522
ret = snprintf(pos, end - pos, "%sIEEE8021X",
523
pos == buf ? "" : " ");
524
if (ret < 0 || ret >= end - pos) {
531
if (ssid->key_mgmt & WPA_KEY_MGMT_NONE) {
532
ret = snprintf(pos, end - pos, "%sNONE",
533
pos == buf ? "" : " ");
534
if (ret < 0 || ret >= end - pos) {
541
if (ssid->key_mgmt & WPA_KEY_MGMT_WPA_NONE) {
542
ret = snprintf(pos, end - pos, "%sWPA-NONE",
543
pos == buf ? "" : " ");
544
if (ret < 0 || ret >= end - pos) {
568
607
static char * wpa_config_write_cipher(int cipher)
570
609
char *buf, *pos, *end;
572
612
pos = buf = wpa_zalloc(50);
577
if (cipher & WPA_CIPHER_CCMP)
578
pos += snprintf(pos, end - pos, "%sCCMP",
579
pos == buf ? "" : " ");
581
if (cipher & WPA_CIPHER_TKIP)
582
pos += snprintf(pos, end - pos, "%sTKIP",
583
pos == buf ? "" : " ");
585
if (cipher & WPA_CIPHER_WEP104)
586
pos += snprintf(pos, end - pos, "%sWEP104",
587
pos == buf ? "" : " ");
589
if (cipher & WPA_CIPHER_WEP40)
590
pos += snprintf(pos, end - pos, "%sWEP40",
591
pos == buf ? "" : " ");
593
if (cipher & WPA_CIPHER_NONE)
594
pos += snprintf(pos, end - pos, "%sNONE",
595
pos == buf ? "" : " ");
617
if (cipher & WPA_CIPHER_CCMP) {
618
ret = snprintf(pos, end - pos, "%sCCMP",
619
pos == buf ? "" : " ");
620
if (ret < 0 || ret >= end - pos) {
627
if (cipher & WPA_CIPHER_TKIP) {
628
ret = snprintf(pos, end - pos, "%sTKIP",
629
pos == buf ? "" : " ");
630
if (ret < 0 || ret >= end - pos) {
637
if (cipher & WPA_CIPHER_WEP104) {
638
ret = snprintf(pos, end - pos, "%sWEP104",
639
pos == buf ? "" : " ");
640
if (ret < 0 || ret >= end - pos) {
647
if (cipher & WPA_CIPHER_WEP40) {
648
ret = snprintf(pos, end - pos, "%sWEP40",
649
pos == buf ? "" : " ");
650
if (ret < 0 || ret >= end - pos) {
657
if (cipher & WPA_CIPHER_NONE) {
658
ret = snprintf(pos, end - pos, "%sNONE",
659
pos == buf ? "" : " ");
660
if (ret < 0 || ret >= end - pos) {
709
779
struct wpa_ssid *ssid)
711
781
char *buf, *pos, *end;
713
784
pos = buf = wpa_zalloc(30);
718
if (ssid->auth_alg & WPA_AUTH_ALG_OPEN)
719
pos += snprintf(pos, end - pos, "%sOPEN",
720
pos == buf ? "" : " ");
722
if (ssid->auth_alg & WPA_AUTH_ALG_SHARED)
723
pos += snprintf(pos, end - pos, "%sSHARED",
724
pos == buf ? "" : " ");
726
if (ssid->auth_alg & WPA_AUTH_ALG_LEAP)
727
pos += snprintf(pos, end - pos, "%sLEAP",
728
pos == buf ? "" : " ");
789
if (ssid->auth_alg & WPA_AUTH_ALG_OPEN) {
790
ret = snprintf(pos, end - pos, "%sOPEN",
791
pos == buf ? "" : " ");
792
if (ret < 0 || ret >= end - pos) {
799
if (ssid->auth_alg & WPA_AUTH_ALG_SHARED) {
800
ret = snprintf(pos, end - pos, "%sSHARED",
801
pos == buf ? "" : " ");
802
if (ret < 0 || ret >= end - pos) {
809
if (ssid->auth_alg & WPA_AUTH_ALG_LEAP) {
810
ret = snprintf(pos, end - pos, "%sLEAP",
811
pos == buf ? "" : " ");
812
if (ret < 0 || ret >= end - pos) {
824
913
eap_methods[i].method != EAP_TYPE_NONE; i++) {
825
914
name = eap_get_name(eap_methods[i].vendor,
826
915
eap_methods[i].method);
828
pos += snprintf(pos, end - pos, "%s%s",
829
pos == buf ? "" : " ", name);
917
ret = snprintf(pos, end - pos, "%s%s",
918
pos == buf ? "" : " ", name);
919
if (ret < 0 || ret >= end - pos)
834
929
#endif /* IEEE8021X_EAPOL */
1243
1338
free(config->ctrl_interface);
1339
free(config->ctrl_interface_group);
1244
1340
free(config->opensc_engine_path);
1245
1341
free(config->pkcs11_engine_path);
1246
1342
free(config->pkcs11_module_path);