- if (passphrase != NULL)
- __connman_service_set_agent_passphrase(service, passphrase);
+ if (passphrase != NULL) {
+ switch (service->security) {
+ case CONNMAN_SERVICE_SECURITY_WEP:
+ case CONNMAN_SERVICE_SECURITY_PSK:
+ __connman_service_set_passphrase(service, passphrase);
+ break;
+ case CONNMAN_SERVICE_SECURITY_8021X:
+ __connman_service_set_agent_passphrase(service,
+ passphrase);
+ break;
+ case CONNMAN_SERVICE_SECURITY_UNKNOWN:
+ case CONNMAN_SERVICE_SECURITY_NONE:
+ case CONNMAN_SERVICE_SECURITY_WPA:
+ case CONNMAN_SERVICE_SECURITY_RSN:
+ DBG("service security '%s' not handled",
+ security2string(service->security));
+ break;
+ }
+ }