~ubuntu-branches/ubuntu/utopic/389-ds-base/utopic-proposed

« back to all changes in this revision

Viewing changes to ldap/servers/plugins/posix-winsync/posix-group-func.c

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2014-02-03 11:08:50 UTC
  • mfrom: (0.2.1)
  • Revision ID: package-import@ubuntu.com-20140203110850-tjzx85elnke9fiu3
Tags: 1.3.2.9-1
* New upstream release.
  - fixes CVE-2013-0336 (Closes: #704077)
  - fixes CVE-2013-1897 (Closes: #704421)
  - fixes CVE-2013-2219 (Closes: #718325)
  - fixes CVE-2013-4283 (Closes: #721222)
  - fixes CVE-2013-4485 (Closes: #730115)
* Drop fix-CVE-2013-0312.diff, upstream.
* rules: Add new scripts to rename.
* fix-sasl-path.diff: Use a triplet path to find libsasl2. (LP:
  #1088822)
* admin_scripts.diff: Add patch from upstream #47511 to fix bashisms.
* control: Add ldap-utils to -base depends.
* rules, rename-online-scripts.diff: Some scripts with .pl suffix are
  meant for an online server, so instead of overwriting the offline
  scripts use -online suffix.
* rules: Enable parallel build, but limit the jobs to 1 for
  dh_auto_install.
* control: Bump policy to 3.9.5, no changes.
* rules: Add get-orig-source target.
* lintian-overrides: Drop obsolete entries, add comments for the rest.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
 $Id: posix-group-func.c 28 2011-05-13 14:35:29Z grzemba $
19
19
 */
20
 
#include "slapi-plugin.h"
21
 
#include "slapi-private.h"
22
 
 
23
20
#include <string.h>
24
21
#include <nspr.h>
 
22
#include "slapi-plugin.h"
25
23
#include "posix-wsp-ident.h"
26
24
 
27
25
#define MAX_RECURSION_DEPTH (5)
61
59
    if (slapi_attr_value_find(oc_attr, slapi_value_get_berval(voc)) != 0) {
62
60
        if (smods) {
63
61
            slapi_mods_add_string(smods, LDAP_MOD_ADD, "objectClass", "dynamicGroup");
64
 
        }
65
 
        else {
66
 
            smods = slapi_mods_new();
67
 
            slapi_mods_add_string(smods, LDAP_MOD_ADD, "objectClass", "dynamicGroup");
68
 
 
69
 
            Slapi_PBlock *mod_pb = slapi_pblock_new();
70
 
            slapi_modify_internal_set_pb_ext(mod_pb, slapi_entry_get_sdn(entry), slapi_mods_get_ldapmods_passout(smods), 0, 0,
71
 
                                             posix_winsync_get_plugin_identity(), 0);
72
 
            slapi_modify_internal_pb(mod_pb);
73
 
            slapi_pblock_destroy(mod_pb);
74
 
 
75
 
            slapi_mods_free(&smods);
 
62
        } else {
 
63
            slapi_entry_add_string(entry, "objectClass", "dynamicGroup");
76
64
        }
77
65
    }
78
66
 
100
88
    }
101
89
    else {
102
90
        slapi_log_error(SLAPI_LOG_FATAL, POSIX_WINSYNC_PLUGIN_NAME,
103
 
                        "getEntry: error searching for uid: %d", rc);
 
91
                        "getEntry: error searching for uid: %d\n", rc);
104
92
    }
105
93
 
106
94
    return NULL;
394
382
        }
395
383
        else {
396
384
            /* PosixGroups except for the top one are already fully mapped out */
397
 
            if ((!hasObjectClass(entry, "posixGroup") || depth == 0) &&
 
385
            if ((!hasObjectClass(entry, "posixGroup") || (depth == 0)) &&
398
386
                (hasObjectClass(child, "ntGroup") || hasObjectClass(child, "posixGroup"))) {
399
387
 
400
388
                /* Recurse downward */
415
403
                        slapi_valueset_add_value(muid_nested_vs, v);
416
404
                    }
417
405
                }
 
406
            } else if (hasObjectClass(child, "posixGroup")) {
 
407
                Slapi_Attr *uid_attr = NULL;
 
408
                Slapi_Value *v = NULL;
 
409
                if (slapi_entry_attr_find(child, "memberuid", &uid_attr) == 0) {
 
410
                    slapi_attr_first_value(uid_attr, &v);
 
411
 
 
412
                    if (v && !slapi_valueset_find(uid_attr, muid_vs, v)) {                        
 
413
                        slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME,
 
414
                                        "getMembershipFromDownward: adding member: %s\n",
 
415
                                        slapi_value_get_string(v));
 
416
                        slapi_valueset_add_value(muid_vs, v);
 
417
                        slapi_valueset_add_value(muid_nested_vs, v);
 
418
                    }
 
419
                }
418
420
            }
419
421
            slapi_entry_free(child);
420
422
        }
628
630
}
629
631
 
630
632
int
631
 
modGroupMembership(Slapi_Entry *entry, Slapi_Mods *smods, int *do_modify)
 
633
modGroupMembership(Slapi_Entry *entry, Slapi_Mods *smods, int *do_modify, int newposixgroup)
632
634
{
633
635
    slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME, "modGroupMembership: ==>\n");
634
636
    slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME, "modGroupMembership: Modding %s\n",
636
638
 
637
639
    int posixGroup = hasObjectClass(entry, "posixGroup");
638
640
 
639
 
    if (!(posixGroup || hasObjectClass(entry, "ntGroup"))) {
 
641
    if (!(posixGroup || hasObjectClass(entry, "ntGroup")) && !newposixgroup) {
640
642
        slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME,
641
643
                        "modGroupMembership end: Not a posixGroup or ntGroup\n");
642
644
        return 0;