vitalnix user management suite 3.2.0


Description

libvxmdsync contains the code for synchronizing the EDS user list to the system user database.

Structures

#include <libvxmdsync/libvxmdsync.h>

struct mdsync_config {
    struct vxdb_user user_defaults;
    int new_pw_length, genpw_type, phash_type;
    int db_force_flush;
    long home_umask;
    char *skeleton_dir;
    char *master_preadd, *master_postadd,
         *master_premod, *master_postmod,
         *master_predel, *master_postdel,
         *user_preadd, *user_postadd,
         *user_premod, *user_postmod,
         *user_predel, *user_postdel;
    char *home_base;
    long split_level;
};

struct mdsync_workspace {
    struct mdsync_config config;
    struct vxdb_state *database;
    ...
};

Function overview

#include <libvxmdsync/libvxmdsync.h>

struct mdsync_workspace *mdsync_init(void);
int mdsync_prepare_group(struct mdsync_workspace *ws, const char *group);
int mdsync_read_file(struct mdsync_workspace *ws, const char *filename, const char *filetype);
int mdsync_open_log(struct mdsync_workspace *ws, const char *filename);
int mdsync_compare(struct mdsync_workspace *ws);
int mdsync_compare_simple(struct mdsync_workspace *ws);
int mdsync_fixup(struct mdsync_workspace *ws);
int mdsync_add(struct mdsync_workspace *ws);
int mdsync_upd(struct mdsync_workspace *ws);
int mdsync_del(struct mdsync_workspace *ws);
void mdsync_free(struct mdsync_workspace *ws);

mdsync_compare

Compares ws->add_req to the system user database. Users which are both in ws->add_req and the VXDB are moved from ws->add_req to ws->keep_req.

If deferred deletion is not configured, puts users, which have been removed from the EDS, but still exist in the VXDB, into ws->delete_now.

If deferred deletion is active, puts users, which do not exist on the EDS anymore, into ws->defer_* depending on their deferred deletion status.

Puts all currently used usernames into ws->lnlist, including those that will be deleted, so usernames do not get reused right away.

mdsync_compare_simple

Puts all usernames from the VXDB into ws->lnlist. This is used for single-user adds, where deletion lists are not needed at all.

mdsync_fixup

Weeds out any double usernames in ws->add_req for new users by appending an appropriate index number to their username, necessarily truncating the name. For example, if there already was a user with the login name jengelh, another one would get jengelh1, the next jengelh2, etc. The maximum characters for a username is hardcoded in libvxmdsync to eight chars (do not change it), making the truncation pattern look like this in the presence of excess users: jengel10, jenge100, jeng1000.

mdsync_init

Order

The synchronization process is divided into a number of functions to facilitate error processing and arguments needed to pass in at once (the struct mdsync_workspace is already big). The exact order of calls to be made is:

  1. mdsync_init()
  2. mdsync_prepare_group()
  3. mdsync_read_file()
  4. mdsync_open_log()
  5. Exactly one of:
    • mdsync_compare()
    • mdsync_compare_simple()
  6. mdsync_fixup()
  7. One or more of the following:
    • mdsync_add()
    • mdsync_upd()
    • mdsync_del()
  8. mdsync_free()