#include <unisecuregen.h>
Inherits UniFilterGen.
Collaboration diagram for UniSecureGen:
The permissions for generator gen are stored in a parallel tree, perms.
It is up to the caller to ensure that the UniPermGen is itself secure. (The easiest way is probably to back it with an ini file in a secure directory.) Note that there is a race condition here: there is no locking to be sure that the UniPermGen is not altered while a key is being looked up. This could come into play, for instance, if the exec permission is removed from a subtree while the UniSecureGen is in the middle of drilldown().
UniSecureGen cannot be created with a moniker due to its extra methods. Instead, just create one with new and mount it with UniConf::mountgen.
Definition at line 31 of file unisecuregen.h.
Public Member Functions | |
UniSecureGen (UniConfGen *_gen, UniPermGen *_perms) | |
UniSecureGen (WvStringParm moniker, UniPermGen *_perms) | |
void | setcredentials (const UniPermGen::Credentials &_cred) |
void | setcredentials (WvStringParm user, const WvStringList &groups) |
virtual WvString | get (const UniConfKey &key) |
Overridden methods. | |
virtual bool | exists (const UniConfKey &key) |
Without fetching its value, returns true if a key exists. | |
virtual void | set (const UniConfKey &key, WvStringParm value) |
Stores a string value for a key into the registry. | |
virtual bool | haschildren (const UniConfKey &key) |
Returns true if a key has children. | |
virtual Iter * | iterator (const UniConfKey &key) |
Returns an iterator over the children of the specified key. | |
UniConfGen * | inner () const |
Returns the inner generator. | |
virtual void | commit () |
Commits any changes. | |
virtual bool | refresh () |
Refreshes information about a key recursively. | |
virtual bool | isok () |
Determines if the generator is usable and working properly. | |
void | setcallback (const UniConfGenCallback &callback, void *userdata) |
Sets the callback for change notification. | |
void | dispatch_delta (const UniConfKey &key, WvStringParm value) |
Immediately sends notification that a key has possibly changed. | |
void | hold_delta () |
Pauses notifications until matched with a call to unhold_delta(). | |
void | unhold_delta () |
Resumes notifications when each hold_delta() has been matched. | |
void | clear_delta () |
Clears the list of pending notifications without sending them. | |
void | flush_delta () |
Flushes the list of pending notifications by sending them. | |
void | delta (const UniConfKey &key, WvStringParm value) |
Call this when a key's value or children have possibly changed. | |
virtual int | str2int (WvStringParm s, int defvalue) const |
Converts a string to an integer. | |
virtual unsigned int | addRef () |
virtual unsigned int | release () |
Protected Member Functions | |
void | setinner (UniConfGen *inner) |
Rebinds the inner generator and prepares its callback. | |
void | seterror (WvStringParm error) |
Raises an error condition. |
|
Definition at line 16 of file unisecuregen.cc. |
|
Definition at line 23 of file unisecuregen.cc. References UniFilterGen::setinner(), and WvStringParm. |
|
Implements IObject. |
|
Clears the list of pending notifications without sending them. Does not affect the hold nesting count. Definition at line 38 of file uniconfgen.cc. |
|
Commits any changes. The default implementation does nothing. Reimplemented from UniConfGen. Definition at line 35 of file unifiltergen.cc. References UniConfGen::commit(). |
|
Call this when a key's value or children have possibly changed. If the hold nesting count is 0, the notification is sent immediately. Otherwise it is added to a pending list for later. Definition at line 69 of file uniconfgen.cc. References UniConfGen::dispatch_delta(), UniConfGen::hold_delta(), UniConfGen::unhold_delta(), and WvStringParm. Referenced by UniClientGen::deltacb(), UniFilterGen::gencallback(), UniMountGen::mountgen(), UniIniGen::refresh(), UniTempGen::set(), UniRegistryGen::set(), UniPStoreGen::set(), and UniMountGen::unmount(). |
|
Immediately sends notification that a key has possibly changed. Takes care of the details of invoking the callback. Note: You probably want to be using delta() instead. Definition at line 62 of file uniconfgen.cc. References WvStringParm. Referenced by UniConfGen::delta(), and UniConfGen::flush_delta(). |
|
Without fetching its value, returns true if a key exists. This is provided because it is often more efficient to test existance than to actually retrieve the value. The default implementation returns !get(key).isnull(). Reimplemented from UniFilterGen. Definition at line 64 of file unisecuregen.cc. References UniFilterGen::exists(), and UniConfKey::removelast(). |
|
Flushes the list of pending notifications by sending them. Does not affect the hold nesting count. Definition at line 44 of file uniconfgen.cc. References UniConfGen::dispatch_delta(). Referenced by UniConfGen::unhold_delta(). |
|
Overridden methods.
Reimplemented from UniFilterGen. Definition at line 53 of file unisecuregen.cc. References UniFilterGen::get(). |
|
Returns true if a key has children. This is provided because it is often more efficient to test existance than to actually retrieve the keys. The default implementation uses the iterator returned by iterator() to test whether the child has any keys. Subclasses are strongly encouraged to provide a better implementation. Reimplemented from UniFilterGen. Definition at line 79 of file unisecuregen.cc. References UniFilterGen::haschildren(). |
|
Pauses notifications until matched with a call to unhold_delta(). While paused, notification events are placed into a pending list. Redundant notifications may be discarded. Use this to safeguard non-reentrant code. Definition at line 23 of file uniconfgen.cc. Referenced by UniMountTreeGen::commit(), UniMountGen::commit(), UniConfGen::delta(), UniClientGen::deltacb(), UniMountTreeGen::exists(), UniMountTreeGen::get(), UniMountTreeGen::haschildren(), UniConfGen::haschildren(), UniMountTreeGen::mountgen(), UniMountGen::mountgen(), UniMountTreeGen::refresh(), UniMountGen::refresh(), UniIniGen::refresh(), UniMountTreeGen::KeyIter::rewind(), UniTempGen::set(), UniClientGen::set(), UniMountTreeGen::unmount(), UniMountGen::unmount(), and UniMountTreeGen::whichmount(). |
|
Returns the inner generator.
Definition at line 36 of file unifiltergen.h. Referenced by UniPermGen::getgroup(), UniPermGen::getowner(), UniPermGen::setgroup(), UniPermGen::setowner(), and UniPermGen::setperm(). |
|
Determines if the generator is usable and working properly. The default implementation always returns true. Reimplemented from UniConfGen. Definition at line 71 of file unifiltergen.cc. References UniConfGen::isok(). |
|
Returns an iterator over the children of the specified key. Must not return NULL; consider returning a NullIter instead. The caller takes ownership of the returned iterator and is responsible for deleting it when finished. Reimplemented from UniFilterGen. Definition at line 87 of file unisecuregen.cc. References UniFilterGen::iterator(). |
|
Refreshes information about a key recursively. May discard uncommitted data. The default implementation always returns true. Reimplemented from UniConfGen. Definition at line 41 of file unifiltergen.cc. References UniConfGen::refresh(). |
|
Implements IObject. |
|
Stores a string value for a key into the registry. If the value is WvString::null, the key is deleted. Returns true on success. Reimplemented from UniFilterGen. Definition at line 72 of file unisecuregen.cc. References UniFilterGen::set(), and WvStringParm. |
|
Sets the callback for change notification. Must not be reimplemented by subclasses. Definition at line 137 of file uniconfgen.cc. References UniConfGenCallback. Referenced by UniMountTreeGen::mountgen(), UniMountGen::mountgen(), UniFilterGen::setinner(), UniCacheGen::UniCacheGen(), UniConfRoot::UniConfRoot(), UniMountTreeGen::unmount(), UniMountGen::unmount(), and UniConfRoot::~UniConfRoot(). |
|
Definition at line 43 of file unisecuregen.cc. References UniPermGen::Credentials::groups, UniPermGen::Credentials::user, and WvStringParm. |
|
Definition at line 33 of file unisecuregen.cc. References UniPermGen::Credentials::groups, and UniPermGen::Credentials::user. |
|
Raises an error condition.
Definition at line 57 of file uniconfgen.h. Referenced by UniClientGen::do_select(), and UniClientGen::get(). |
|
Rebinds the inner generator and prepares its callback. The previous generator is NOT destroyed. "inner" must not be null. Definition at line 24 of file unifiltergen.cc. References UniFilterGen::gencallback(), UniConfGen::setcallback(), and UniConfGenCallback. Referenced by UniFilterGen::UniFilterGen(), UniPermGen::UniPermGen(), and UniSecureGen(). |
|
Converts a string to an integer. If the string is null or not recognized, return defvalue. This is here to support the common str2int(get(key)). The default implementation recognizes the booleans 'true', 'yes', 'on' and 'enabled' as 1, and 'false', 'no', 'off' and 'disabled' as 0. Definition at line 105 of file uniconfgen.cc. References WvFastString::cstr(), WvFastString::isnull(), and WvStringParm. |
|
Resumes notifications when each hold_delta() has been matched. On resumption, dispatches all pending notifications except those that were destined to watches that were removed. Use this to safeguard non-reentrant code. Definition at line 29 of file uniconfgen.cc. References UniConfGen::flush_delta(). Referenced by UniMountTreeGen::commit(), UniMountGen::commit(), UniConfGen::delta(), UniClientGen::deltacb(), UniMountTreeGen::exists(), UniMountTreeGen::get(), UniMountTreeGen::haschildren(), UniConfGen::haschildren(), UniMountTreeGen::mountgen(), UniMountGen::mountgen(), UniMountTreeGen::refresh(), UniMountGen::refresh(), UniIniGen::refresh(), UniMountTreeGen::KeyIter::rewind(), UniTempGen::set(), UniClientGen::set(), UniMountTreeGen::unmount(), UniMountGen::unmount(), and UniMountTreeGen::whichmount(). |