[PATCH/RFC V3 07/13] Split user-visible oc_* fields from internal fields

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

 



On Sat, 2013-12-14 at 22:42 -0800, Kevin Cernekee wrote:
> @@ -912,40 +967,40 @@ int prepare_stoken(struct openconnect_info *vpninfo)
>         memset(&opts, 0, sizeof(opts));
>  
>         form.opts = opts;
> -       form.message = (char *)_("Enter credentials to unlock software token.");
> +       form.u.message = (char *)_("Enter credentials to unlock software token.");

This depends on an earlier 'Hack around const warnings' commit in your
tree, btw.

Thanks for doing this work. It mostly looks good to me. However, I'm
wondering if we can get away without the parallel definitions of public
vs. private structures, and *especially* without the parallel linked
lists of options, and this:

> +static int dup_select_opt(struct __oc_form_opt_select *sopt)
> +{
> +       struct oc_form_opt_select *usopt;
> +       int i;
> +
> +       if (!sopt->nr_choices)
> +               return -EINVAL;
> +
> +       usopt = calloc(1, sizeof(*sopt) + sizeof(struct oc_choice) * sopt->nr_choices);
> +       if (!usopt)
> +               return -ENOMEM;
> +
> +       usopt->form = sopt->form.u;
> +       usopt->nr_choices = sopt->nr_choices;
> +       for (i = 0; i < usopt->nr_choices; i++)
> +               usopt->choices[i] = sopt->choices[i].u;
> +       sopt->u = usopt;
> +       return 0;
> +}

Let's assume we can bump the ABI version to libopenconnect.so.3. So we
can add a OC_FORM_OPT_IGNORE flag into items in the *main* list to make
the UI ignore them, instead of having to put them in a second list,
right?

And let's also assume (or *declare* that the UI will never be allocating
these structures. So if we need private fields, we could do something
like:

struct oc_choice {
 	char *name;
	char *label;
	char *auth_type;
	char *override_name;
	char *override_label;
#ifdef __OPENCONNECT_PRIVATE__
        int second_auth;
	char *secondary_username;
	int secondary_username_editable;
	int noaaa;
#endif
};

Hell, we could even process the openconnect.h with unifdef or something
like that on 'make install', if we really wanted to.

How does that sound?

-- 
dwmw2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5745 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openconnect-devel/attachments/20131230/a6913c24/attachment.bin>


[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux