summaryrefslogtreecommitdiffstats
path: root/src/account
Commit message (Collapse)AuthorAgeFilesLines
* account: Add tests for invalid system filesAlois Mahdal2014-03-252-1/+570
| | | | | | Each test creates an instance it LMI_Account, then intentionally cripples one of system files related to users/groups, and performs a simple sanity test that checks if instance properties are readable.
* Account: Try to make coverity happy.Robin Hack2014-03-051-3/+5
| | | | Fix nonsense if statement in indication_common.c.
* account: Added test for race conditionsAlois Mahdal2014-02-273-0/+406
| | | | | | | | Based on bug 1061153, these tests attempt to create, modify or delete users from a number of threads. Clean up is done by reverting backup of /etc/passwd, /etc/groups, /etc/shadow and /etc/gshadow.
* Account: Race conditions fixes (like: bz#1061150)Robin Hack2014-02-135-87/+149
| | | | | | | | | This patch solves: * Avoid race conditions with shadow-utils. * Avoid race condition with libuser: uid/gid "sharing" amoung users/groups. * Fix deadlock in lock.c code. This patch introduces giant lock which is held for all write operations.
* indicationmanager: Handle EOF in inotify readRadek Novacek2014-01-211-0/+6
|
* Updated copyright yearsPeter Schiffer2014-01-1638-38/+38
| | | | Updated copyright years to include new year 2014.
* Remove trailing spacesPeter Schiffer2014-01-1613-486/+486
| | | | This patch removes trailing spaces from source files.
* account: Use lckpwdf() to protect passwd filesTomas Bzatek2014-01-145-0/+83
| | | | | | | | | Glibc provides convenient lock functions to protect passwd and shadow files. This commit makes use of them for any write operation. Read access is still unprotected for the time being for performance reasons. https://fedorahosted.org/openlmi/ticket/205
* Use re-entrant version of strerror() for thread safetyTomas Bzatek2014-01-091-1/+2
|
* tests: ensure the use of exceptions is well definedMichal Minar2014-01-081-2/+2
| | | | | | | | | | | | | | | Some tests expect that exceptions won't be thrown out of LMIShell's functions. Others prefers them and enable them globally. This causes problems when running under nosetests all provider tests at once. Tests that modified enablement of exception throws globally caused others to fail. This patch makes sure that each TestCase has defined use of exceptions. Default state is to have them disabled. If a TestCase prefers having them enabled, just one variable needs to be overriden in its body: class AccountBase(lmibase.LmiTestCase): USE_EXCEPTIONS = True
* account: Port tests to lmishell baseTomas Bzatek2014-01-036-112/+126
|
* account: Code cleanupTomas Bzatek2013-12-201-10/+1
| | | | Unused variable, unused assignment.
* account: Initialize NULL the group array to prevent bad memory accessTomas Bzatek2013-12-031-1/+2
| | | | | | | | | Found by clang analysis: Error: PW.BRANCH_PAST_INITIALIZATION: openlmi-providers-0.4.1_75_gf47c906/src/account/LMI_AccountProvider.c:324: branch_past_initialization: transfer of control bypasses initialization of: openlmi-providers-0.4.1_75_gf47c906/src/account/LMI_AccountProvider.c:324: caretline: ^ openlmi-providers-0.4.1_75_gf47c906/src/account/LMI_AccountProvider.c:324: name_at_decl_position: variable "groups" (declared at line 328)
* account: Fall back to /etc/passwd if /etc/shadow returns NULL passwordTomas Bzatek2013-12-031-4/+10
| | | | | | | | | | | | In certain cases password may be stored in /etc/passwd directly and we need to tell libuser where to pull the password from. This patch automatically falls back to /etc/passwd if there's no password found in /etc/shadow. In case password retrieval fails in both cases, the UserPassword and UserPasswordEncoding LMI_Account properties are left unset. Based on a patch by Klaus Kämpf <kkaempf@suse.de> https://bugzilla.redhat.com/show_bug.cgi?id=1031334
* account: Free private indication data after indications are stoppedTomas Bzatek2013-11-282-6/+10
| | | | | ...to prevent race of the watcher thread still using data that has been freed just a moment ago.
* account: Fix some memory leaksTomas Bzatek2013-11-213-1/+6
| | | | GValue memory management is tricky...
* indmanager: Introduce common filter checkerTomas Bzatek2013-11-154-44/+14
| | | | | | | | | | | The filter checker code was kinda duplicate across providers and no special plans have been made for it. This change makes passing a filter checker callback during indication manager creation no longer mandatory and default filter checker will be used when NULL. However, the list of acceptable classes need to be registered before first use. This change also brings greater flexibility of the filter query which may now consist of multiple limit conditions.
* account: Make filter names in tests nicerTomas Bzatek2013-11-151-5/+5
| | | | Don't create very long strings (although it's a nice stress to CIMOM).
* account: Ignore homedir deletion failures when deleting an userTomas Bzatek2013-11-111-6/+7
| | | | | | | | | | It was impossible to remove user when its home directory was unable to delete, e.g. either pointing to a bad location or inaccessible as in not being mounted, etc. Even the "force" argument didn't help. For this reason, any failure on homedir deletion is now ignored and a warning is noted in the log. The particular error return code is unused now but kept in the MOF file for compatibility, adding a note.
* account: Watch parent directory instead of files directlyTomas Bzatek2013-11-112-63/+34
| | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the way the inotify watching is done. Instead of watching files directly, we watch the directory they reside in and just filter out changes in files we don't want to watch. This brings a benefit of reliable notification through file deletions and other inode number changing changes. It's also less racy as we had to recreate watches on IN_IGNORED events with possibility of missing some events. File deletions or atomic replaces were always problematic. There are some lingering issues however. The most severe is a problem of shadow files and libuser calls. At the time the event is processed further in the gather() method, shadow files may not been updated yet. This causes libuser to miss some information required for proper CIM object instance construction, potentially propagating half-baked data to the user. This could be solved by implementing a settle timeout, possibly compressing more fast-coming events into one. For the moment a simple artificial sleep has been put before returning from the watcher in good hope shadow files are updated properly. Then there's a current problem of throwing out the rest of the read buffer, losing notifications of other files if watched. This is by current design of the watcher callback and could be fixed by implementing proper event queue.
* Fix libuser require once againTomas Bzatek2013-11-061-1/+1
| | | | | | | CMake doesn't like spaces around version requirements in pkg-config checks. Unfortunately also maintains configure cache and doesn't pick the changes in CMakeLists.txt up automatically so my typo went unspotted during testing. Damn.
* Require libuser >= 0.60Tomas Bzatek2013-11-061-1/+1
| | | | | The commit aac4d3a0d1dc brought new symbols in the code without bumping libuser version req.
* Fix coverity issuesRadek Novacek2013-11-041-2/+8
|
* account: Fix libuser object cleanupTomas Bzatek2013-11-042-4/+4
| | | | | Potential double free or freeing of uninitialized memory. Fixes some asserts thrown from libuser.
* account: Start watching right upon indication subscriptionTomas Bzatek2013-11-044-41/+90
| | | | | | | | | | This is an attempt to get rid of most probable race conditions by creating inotify watches outside the watcher thread and making them persistent for the whole time the indication subscription is active. There's a certain amount of time when watching if off due to gather part of the indication manager. Leaving a watch fd open with active watches allows us to queue events that we process next time the watcher is called (once gather part is finished).
* tests: adjusted test suits for changes in lmi.testMichal Minar2013-11-041-3/+3
| | | | | Base test classes have been renamed, this patch makes small provider tests working again.
* Account: Whitespaces removed.Robin Hack2013-11-041-6/+6
| | | | Whitespaces hunting.
* Use configured ComputerSystem class name.Jan Safranek2013-11-011-1/+1
|
* Account: Added 3 changes as one.Robin Hack2013-10-313-106/+243
| | | | | | 1) Account: Use new atomic libuser api. 2) Account: Added author and license to lock.c and lock.h. 3) Account: Added group locking to LMI_AccountProvider.
* Add lmi_get_computer_system function and fix lmi_get_system_nameRadek Novacek2013-10-3121-125/+88
| | | | | | | | | | | | | | PG_ComputerSystem has different method how to get hostname than our providers. In order to create the associations to this class we need to enumerate it. The downside is that all providers must supply CMPIContext to the lmi_init function. New function lmi_get_computer_system returns CMPIObjectPath to the configured CIM_ComputerSystem subclass instance. This object should be used in all references with ComputerSystem. Function lmi_get_system_name has been altered to return same value as ComputerSystem "Name" property.
* tests: use shared base class in provider testsMichal Minar2013-10-245-179/+15
| | | | Done for: Account, Journald and LogicalFile
* Fix some compilation warnings and coverity issuesRadek Novacek2013-10-222-3/+6
|
* Rework documentation.Jan Safranek2013-10-187-772/+0
| | | | | | | | | | - Everything is in openlmi-providers/doc/admin directory. - 'make doc' automatically builds documentation of all enabled providers. - Documentation shares one 'conf.py' for sphinx. - All documentation uses the same directory structure. There is only one CMakefile.txt to generate all the docs.
* account: Fix invalid change from migration from Linux_ to PG_Radek Novacek2013-10-171-1/+1
|
* Use PG_ComputerSystem by default.Jan Safranek2013-10-094-6/+6
| | | | | | | And get rid of sblim-cmpi-base dependency. It would be nice if our tests have an option to select Linux_ComputerSystem or PG_ComputerSystem in the future...
* Account: Documentation improvementRoman Rakus2013-10-031-12/+12
| | | | | | Use dict parameter in first_instance method Signed-off-by: Roman Rakus <rrakus@redhat.com>
* Account: Set correct version in documentationRoman Rakus2013-10-031-2/+2
| | | | Signed-off-by: Roman Rakus <rrakus@redhat.com>
* Add OpenLMI theme for Sphinx.Jan Safranek2013-10-021-2/+2
| | | | Note that the theme is BSD-licensed.
* Remove 'OpenLMI Account CIM classes' from overall documentation.Jan Safranek2013-10-022-6/+13
| | | | | | | | | In overall documentation, generated by tools/gendoc utility, we do not want to include description of classes from individual OpenLMI providers in their docs. Instead, we want to have one reference with _all_ OpenLMI classes, which will the individual providers reference.
* Remove "Indices and tables" from generated docs, they seem to be useless.Jan Safranek2013-10-021-9/+0
|
* Account: Add DeleteGroup method to be consistent with user's deletionRoman Rakus2013-09-302-41/+114
| | | | | | | | | | | User deletetion is done by DeleteUser method. Added similar method to delete a group. Also do the check if the group isn't a primary group of a user. Changed documentation accordingly. Signed-off-by: Roman Rakus <rrakus@redhat.com>
* account: Fix removing member of groupRoman Rakus2013-09-261-3/+4
| | | | Signed-off-by: Roman Rakus <rrakus@redhat.com>
* account: Allow to set plain text passwordRoman Rakus2013-09-202-1/+65
| | | | | | libuser has a mechanism to encrypt password Signed-off-by: Roman Rakus <rrakus@redhat.com>
* Call lmi_init function from providersRadek Novacek2013-09-1923-0/+54
|
* Account: Better failure check of lock pool initialization.Robin Hack2013-09-181-1/+2
|
* Introduce toplevel openlmi config fileRadek Novacek2013-09-181-2/+1
| | | | | | | | | | | | | Toplevel openlmi configuration file (/etc/openlmi/openlmi.conf) now contains common configuration options for all providers. Configuration for each provider could be overriden in provider-specific config (/etc/openlmi/$provider/$provider.conf). This patch also modify config file handling in python providers to include this config file. There is also support for C providers (in libopenlmicommon) for reading these config files and providing default configuration options.
* Account: Removed unused macro undefinitions.Robin Hack2013-09-111-5/+0
|
* Account: Added associative thread locking.Robin Hack2013-09-104-0/+242
|
* Account: Better return values for methodsRoman Rakus2013-09-051-14/+31
| | | | Signed-off-by: Roman Rakus <rrakus@redhat.com>
* Account: Fix memory leaksRoman Rakus2013-09-051-0/+6
| | | | Signed-off-by: Roman Rakus <rrakus@redhat.com>