Hi Patrik,
On ma, 2014-09-08 at 13:38 +0300, Patrik Flykt wrote:
> Create a local passphrase setting function as config files would
> otherwise use the internal passphrase setting function which disallows
> modifications to immutable .config files.
Perhaps it would be more logical to set the immutable flag in config.c
after we have set the passphrase, now it is set before which causes
these problems. Then we do not need to tweak the set passphrase function
at all.
> ---
> src/service.c | 18 ++++++++++++++----
> 1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/src/service.c b/src/service.c
> index d96713d..e6a5240 100644
> --- a/src/service.c
> +++ b/src/service.c
> @@ -2876,12 +2876,12 @@ static int check_passphrase(enum
> connman_service_security security,
> return 0;
> }
>
> -int __connman_service_set_passphrase(struct connman_service *service,
> - const char *passphrase)
> +static int set_passphrase(struct connman_service *service,
> + const char *passphrase)
> {
> int err;
>
> - if (service->immutable || service->hidden)
> + if (service->hidden)
> return -EINVAL;
>
> err = check_passphrase(service->security, passphrase);
> @@ -2900,6 +2900,15 @@ int __connman_service_set_passphrase(struct
> connman_service *service,
> return 0;
> }
>
> +int __connman_service_set_passphrase(struct connman_service *service,
> + const char *passphrase)
> +{
> + if (service->immutable)
> + return -EINVAL;
> +
> + return set_passphrase(service, passphrase);
> +}
> +
> const char *__connman_service_get_passphrase(struct connman_service *service)
> {
> if (!service)
> @@ -4973,7 +4982,8 @@ void __connman_service_set_string(struct
> connman_service *service,
> g_free(service->phase2);
> service->phase2 = g_strdup(value);
> } else if (g_str_equal(key, "Passphrase"))
> - __connman_service_set_passphrase(service, value);
> + set_passphrase(service, value);
> +
> }
>
> void __connman_service_set_search_domains(struct connman_service *service,
Cheers,
Jukka
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman