[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [RFC v4] [PATCH 3/3] Add WPA support to netcfg



Glenn Saberton <gsaberton@foomagic.org> writes:

> diff --git a/packages/netcfg/wireless.c b/packages/netcfg/wireless.c
<...>
> +int netcfg_wireless_set_security (struct debconfclient *client, char *iface)
> +{
> +  int ret = 0 ;
> +  debconf_subst (client, "netcfg/wireless_security_type", "iface", iface);
> +  debconf_input (client, "high", "netcfg/wireless_security_type");
> +  ret = debconf_go(client);
> +
> +  if (ret == 30)
> +    return GO_BACK;
> +
> +  debconf_get (client, "netcfg/wireless_security_type");
> +
> +  if (!strcmp(client->value, "WEP/Open Network"))
> +     return REPLY_WEP;
> +  else
> +     return REPLY_WPA;
> +
> +}
> +
>  int netcfg_wireless_set_wep (struct debconfclient * client, char* iface)
>  {
>      wireless_config wconf;
> @@ -250,6 +270,50 @@ int netcfg_wireless_set_wep (struct debconfclient * client, char* iface)
>      return 0;
>  }
>  
> +int netcfg_set_passphrase (struct debconfclient *client, char *iface)
> +{
> +  wireless_config wconf;
> +  int ret;
> +
> +  iw_get_basic_config(wfd, iface, &wconf);
> +
> +  unset_wep_key(iface);
> +
> +  debconf_subst(client, "netcfg/wireless_wpa", "iface", iface);
> +  debconf_input(client, "high", "netcfg/wireless_wpa");
> +  ret = debconf_go(client);
> +
> +  if (ret == 30)
> +    return GO_BACK;
> +
> +  debconf_get(client, "netcfg/wireless_wpa");
> +  passphrase = client->value;
> +
> +  while (strlen(passphrase) < WPA_MIN || strlen(passphrase) > WPA_MAX) {
> +      debconf_subst(client, "netcfg/invalid_pass", "passphrase", passphrase);
> +      debconf_input(client, "critical", "netcfg/invalid_pass");
> +      debconf_go(client);
> +
> +      debconf_input(client, "high", "netcfg/wireless_wpa");
> +      ret = debconf_go (client);
> +
> +
> +      if (ret == 30)
> +        return GO_BACK;
> +
> +      debconf_get (client, "netcfg/wireless_wpa");
> +      passphrase = client->value;
> +    }
> +
> +  if (netcfg_write_wpa(essid, passphrase)) {
> +    di_warning("Failed to write wpasupplicant config file");
> +    return -1;
> +   }
> +  else
> +      start_wpa_supplicant(client);
> +  return 0;
> +}
> +
>  #else
>  
>  int is_wireless_iface (const char *iface)

Different indenting. Please fix it.

> diff --git a/packages/netcfg/wpa.c b/packages/netcfg/wpa.c

Same here.

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio@debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."


Reply to: