diff options
author | Jan Zeleny <jzeleny@redhat.com> | 2011-05-27 07:32:17 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-06-02 14:07:45 -0400 |
commit | ace07a7d75c5a7c3f5613e5349fa8c1ffd05863a (patch) | |
tree | 19edfcd88debcccad56c03e75b5c94294d183983 /src/db | |
parent | ba33be9b40ecbe6f98a52025348dbcff43273b40 (diff) | |
download | sssd-ace07a7d75c5a7c3f5613e5349fa8c1ffd05863a.tar.gz sssd-ace07a7d75c5a7c3f5613e5349fa8c1ffd05863a.tar.xz sssd-ace07a7d75c5a7c3f5613e5349fa8c1ffd05863a.zip |
Non-posix group processing - sysdb changes
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/sysdb.h | 5 | ||||
-rw-r--r-- | src/db/sysdb_ops.c | 40 |
2 files changed, 26 insertions, 19 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h index 68fc69864..1eac748c0 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -62,6 +62,7 @@ #define SYSDB_MEMBER "member" #define SYSDB_MEMBERUID "memberUid" +#define SYSDB_POSIX "isPosix" #define SYSDB_DEFAULTGROUP "defaultGroup" #define SYSDB_GECOS "gecos" @@ -154,7 +155,7 @@ NULL} #define SYSDB_INITGR_ATTR SYSDB_MEMBEROF -#define SYSDB_INITGR_ATTRS {SYSDB_GIDNUM, \ +#define SYSDB_INITGR_ATTRS {SYSDB_GIDNUM, SYSDB_POSIX, \ SYSDB_DEFAULT_ATTRS, \ NULL} @@ -518,7 +519,7 @@ int sysdb_add_incomplete_group(struct sysdb_ctx *ctx, struct sss_domain_info *domain, const char *name, gid_t gid, - const char *original_dn); + const char *original_dn, bool posix); /* Add netgroup (only basic attrs and w/o checks) */ int sysdb_add_basic_netgroup(struct sysdb_ctx *ctx, diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index 1fb389da9..a7911de4e 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -1062,6 +1062,7 @@ int sysdb_add_group(TALLOC_CTX *mem_ctx, uint32_t id; time_t now; int ret; + bool posix; if (domain->id_max != 0 && gid != 0 && (gid < domain->id_min || gid > domain->id_max)) { @@ -1110,22 +1111,6 @@ int sysdb_add_group(TALLOC_CTX *mem_ctx, ret = sysdb_add_basic_group(tmpctx, ctx, domain, name, gid); if (ret) goto done; - if (gid == 0) { - ret = sysdb_get_new_id(tmpctx, ctx, domain, &id); - if (ret) goto done; - - if (!attrs) { - attrs = sysdb_new_attrs(tmpctx); - if (!attrs) { - ret = ENOMEM; - goto done; - } - } - - ret = sysdb_attrs_add_uint32(attrs, SYSDB_GIDNUM, id); - if (ret) goto done; - } - if (!attrs) { attrs = sysdb_new_attrs(tmpctx); if (!attrs) { @@ -1134,6 +1119,23 @@ int sysdb_add_group(TALLOC_CTX *mem_ctx, } } + ret = sysdb_attrs_get_bool(attrs, SYSDB_POSIX, &posix); + if (ret == ENOENT) { + posix = true; + ret = sysdb_attrs_add_bool(attrs, SYSDB_POSIX, true); + if (ret) goto done; + } else if (ret != EOK) { + goto done; + } + + if (posix && gid == 0) { + ret = sysdb_get_new_id(tmpctx, ctx, domain, &id); + if (ret) goto done; + + ret = sysdb_attrs_add_uint32(attrs, SYSDB_GIDNUM, id); + if (ret) goto done; + } + now = time(NULL); ret = sysdb_attrs_add_time_t(attrs, SYSDB_LAST_UPDATE, now); @@ -1163,7 +1165,8 @@ int sysdb_add_incomplete_group(struct sysdb_ctx *ctx, struct sss_domain_info *domain, const char *name, gid_t gid, - const char *original_dn) + const char *original_dn, + bool posix) { TALLOC_CTX *tmpctx; time_t now; @@ -1194,6 +1197,9 @@ int sysdb_add_incomplete_group(struct sysdb_ctx *ctx, now-1); if (ret) goto done; + ret = sysdb_attrs_add_bool(attrs, SYSDB_POSIX, posix); + if (ret) goto done; + if (original_dn) { ret = sysdb_attrs_add_string(attrs, SYSDB_ORIG_DN, original_dn); if (ret) goto done; |