Re: [PATCH] libnm-util: allow empty number for gsm settings



On Thu, 2012-02-02 at 09:39 +0100, Thomas Bechtold wrote:
> ---
>  libnm-util/nm-setting-gsm.c     |   14 --------------
>  libnm-util/tests/test-general.c |   23 +++++++++++++++++++++++
>  2 files changed, 23 insertions(+), 14 deletions(-)

Pushed, thanks!

Dan

> diff --git a/libnm-util/nm-setting-gsm.c b/libnm-util/nm-setting-gsm.c
> index 80d3fd3..19c59f2 100644
> --- a/libnm-util/nm-setting-gsm.c
> +++ b/libnm-util/nm-setting-gsm.c
> @@ -292,20 +292,6 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
>  {
>  	NMSettingGsmPrivate *priv = NM_SETTING_GSM_GET_PRIVATE (setting);
>  
> -	if (!priv->number) {
> -		g_set_error (error,
> -		             NM_SETTING_GSM_ERROR,
> -		             NM_SETTING_GSM_ERROR_MISSING_PROPERTY,
> -		             NM_SETTING_GSM_NUMBER);
> -		return FALSE;
> -	} else if (!strlen (priv->number)) {
> -		g_set_error (error,
> -		             NM_SETTING_GSM_ERROR,
> -		             NM_SETTING_GSM_ERROR_INVALID_PROPERTY,
> -		             NM_SETTING_GSM_NUMBER);
> -		return FALSE;
> -	}
> -
>  	if (priv->apn) {
>  		guint32 apn_len = strlen (priv->apn);
>  		guint32 i;
> diff --git a/libnm-util/tests/test-general.c b/libnm-util/tests/test-general.c
> index c4c696f..c8d392c 100644
> --- a/libnm-util/tests/test-general.c
> +++ b/libnm-util/tests/test-general.c
> @@ -444,6 +444,28 @@ test_setting_gsm_apn_underscore (void)
>  	g_assert (success == TRUE);
>  }
>  
> +static void
> +test_setting_gsm_without_number (void)
> +{
> +	NMSettingGsm *s_gsm;
> +	GError *error = NULL;
> +	gboolean success;
> +
> +	s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
> +	g_assert (s_gsm);
> +
> +	g_object_set (s_gsm, NM_SETTING_GSM_NUMBER, NULL, NULL);
> +	success = nm_setting_verify (NM_SETTING (s_gsm), NULL, &error);
> +	g_assert_no_error (error);
> +	g_assert (success == TRUE);
> +
> +	g_object_set (s_gsm, NM_SETTING_GSM_NUMBER, "", NULL);
> +	success = nm_setting_verify (NM_SETTING (s_gsm), NULL, &error);
> +	g_assert_no_error (error);
> +	g_assert (success == TRUE);
> +
> +}
> +
>  static NMSettingWirelessSecurity *
>  make_test_wsec_setting (const char *detail)
>  {
> @@ -1359,6 +1381,7 @@ int main (int argc, char **argv)
>  	test_setting_gsm_apn_spaces ();
>  	test_setting_gsm_apn_bad_chars ();
>  	test_setting_gsm_apn_underscore ();
> +	test_setting_gsm_without_number ();
>  	test_setting_to_hash_all ();
>  	test_setting_to_hash_no_secrets ();
>  	test_setting_to_hash_only_secrets ();




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