Changeset 3ac6d9f for protocols


Ignore:
Timestamp:
2016-03-23T06:44:13Z (8 years ago)
Author:
Dennis Kaarsemaker <dennis@…>
Branches:
master
Children:
e41ba05
Parents:
d701547
git-author:
Dennis Kaarsemaker <dennis@…> (22-02-16 20:04:10)
git-committer:
Dennis Kaarsemaker <dennis@…> (23-03-16 06:44:13)
Message:

Support for locked-down accounts

In certain situations, e.g. when working with pregenerated
configurations, it is useful to be able lock down accounts so they
cannot be deleted and authentication information (user, password,
server) cannot be changed.

We mark such sensitive settings with ACC_SET_LOCKABLE and will refuse to
change them if the account is locked by setting the ACC_FLAG_LOCKED
flag.

This flag is stored in the xml files as account attribute locked="true".

Location:
protocols
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • protocols/account.c

    rd701547 r3ac6d9f  
    6767
    6868        s = set_add(&a->set, "password", NULL, set_eval_account, a);
    69         s->flags |= SET_NOSAVE | SET_NULL_OK | SET_PASSWORD;
     69        s->flags |= SET_NOSAVE | SET_NULL_OK | SET_PASSWORD | ACC_SET_LOCKABLE;
    7070
    7171        s = set_add(&a->set, "tag", NULL, set_eval_account, a);
     
    7373
    7474        s = set_add(&a->set, "username", NULL, set_eval_account, a);
    75         s->flags |= SET_NOSAVE | ACC_SET_OFFLINE_ONLY;
     75        s->flags |= SET_NOSAVE | ACC_SET_OFFLINE_ONLY | ACC_SET_LOCKABLE;
    7676        set_setstr(&a->set, "username", user);
    7777
  • protocols/account.h

    rd701547 r3ac6d9f  
    6363        ACC_SET_OFFLINE_ONLY = 0x02,    /* Allow changes only if the acct is offline. */
    6464        ACC_SET_ONLINE_ONLY = 0x04,     /* Allow changes only if the acct is online. */
     65        ACC_SET_LOCKABLE = 0x08         /* Setting cannot be changed if the account is locked down */
    6566} account_set_flag_t;
    6667
     
    7071        ACC_FLAG_HANDLE_DOMAINS = 0x04, /* Contact handles need a domain portion. */
    7172        ACC_FLAG_LOCAL = 0x08,          /* Contact list is local. */
     73        ACC_FLAG_LOCKED = 0x10,         /* Account is locked (cannot be deleted, certain settings can't changed) */
    7274} account_flag_t;
    7375
Note: See TracChangeset for help on using the changeset viewer.