Changeset 3ac6d9f for storage_xml.c


Ignore:
Timestamp:
2016-03-23T06:44:13Z (5 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".

File:
1 edited

Legend:

Unmodified
Added
Removed
  • storage_xml.c

    rd701547 r3ac6d9f  
    8686{
    8787        struct xml_parsedata *xd = data;
    88         char *protocol, *handle, *server, *password = NULL, *autoconnect, *tag;
     88        char *protocol, *handle, *server, *password = NULL, *autoconnect, *tag, *locked;
    8989        char *pass_b64 = NULL;
    9090        unsigned char *pass_cr = NULL;
     
    9999        autoconnect = xt_find_attr(node, "autoconnect");
    100100        tag = xt_find_attr(node, "tag");
     101        locked = xt_find_attr(node, "locked");
    101102
    102103        protocol = xt_find_attr(node, "protocol");
     
    126127                if (local) {
    127128                        acc->flags |= ACC_FLAG_LOCAL;
     129                }
     130                if (locked && !g_strcasecmp(locked, "true")) {
     131                        acc->flags |= ACC_FLAG_LOCKED;
    128132                }
    129133        } else {
     
    320324                        xt_add_attr(cur, "server", acc->server);
    321325                }
     326                if (acc->flags & ACC_FLAG_LOCKED) {
     327                        xt_add_attr(cur, "locked", "true");
     328                }
    322329
    323330                g_free(pass_b64);
Note: See TracChangeset for help on using the changeset viewer.