[sssd PR#34][opened] cache_req: move from switch to plugins
by fidencio
URL: https://github.com/SSSD/sssd/pull/34
Author: pbrezina
Title: #34: cache_req: move from switch to plugins
Action: opened
PR body:
"""
cache_req grown quite big from the original code and it turned out
that using switch statements to branch code for different cases
makes the code quite hard to read and further extend and any
modification to the logic itself is difficult.
This patch changes the switch statements to plugins with small
functions and separates logic into multiple modules. This gives
us better control over the code and improves readability and
maintainability while keeping code duplication to minimum.
At the moment only cache req user by name, id and upn is
implemented as a proof of concept. If you like it, I will
finish the rest, it won't take much time.
"""
To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/34/head:pr34
git checkout pr34
7 years, 5 months
[sssd PR#13] MEMBEROF: Don't resolve members if they are removed (opened)
by fidencio
celestian's pull request #13: "MEMBEROF: Don't resolve members if they are removed" was opened
PR body:
"""
## TOPIC
If we need remove ghost (SYSDB_GHOST, DB_GHOST) attribute
from group we use empty structure.
This doesn't mean that there is pointer to NULL but
it means that there is zero elements.
Ghost attribute is array not string.
Resolves:
https://fedorahosted.org/sssd/ticket/2940
## REPRODUCER
preparing:
```
ipa user-add --first=Adam --last=Adam --email=adam(a)persei.cz adam
ipa group-add group_1
ipa group-add-member --users=adam group_1
ipa group-add group_2
```
reproducer (possible repeat):
```
systemctl daemon-reload
sudo su -c "truncate -s0 /var/log/sssd/*.log"
sudo su -c "rm -f /var/lib/sss/db/*"
sudo su -c "rm -f /var/lib/sss/mc/*"
sudo systemctl restart sssd.service
ipa group-add-member --groups=group_1 group_2
sss_cache -UG
sudo su -c "truncate -s0 /var/log/sssd/*.log"
getent group group_2
ipa group-remove-member --groups=group_1 group_2
sss_cache -UG
sudo su -c "truncate -s0 /var/log/sssd/*.log"
getent group group_2
```
"""
See the full pull-request at https://github.com/SSSD/sssd/pull/13
... or pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/13/head:pr13
git checkout pr13
7 years, 5 months
[sssd PR#33][opened] SECRETS: Some small misc fixes + fixing #3136
by fidencio
URL: https://github.com/SSSD/sssd/pull/33
Author: fidencio
Title: #33: SECRETS: Some small misc fixes + fixing #3136
Action: opened
PR body:
"""
This series was made on top of Jakub's patches adding Secrets'
documentation, that is applied on top of my own patches adding
a the update-confdb-process.
The patches that needs to be reviewed are the last 6 patches, and
they're listed below:
f587a7c (Fabiano Fidêncio, 3 days ago)
SECRETS: Add a configurable depth limit for nested containers
Resolves: https://fedorahosted.org/sssd/ticket/3168
Signed-off-by: Fabiano Fidêncio <fidencio(a)redhat.com>
e98bd63 (Fabiano Fidêncio, 7 hours ago)
SECRETS: Use a tmp_context on local_db_check_containers()
Otherwise the struct ldb_dn will be hanging on the mem_ctx till it gets
freed.
Signed-off-by: Fabiano Fidêncio <fidencio(a)redhat.com>
4a90c20 (Fabiano Fidêncio, 7 hours ago)
SECRETS: Make functions from local.c static
There's no reason for those functions to be exposed.
Signed-off-by: Fabiano Fidêncio <fidencio(a)redhat.com>
67e1301 (Fabiano Fidêncio, 10 hours ago)
CONFIG: Add secrets' provider option
The provider option specifies where should the secrets be stored.
Signed-off-by: Fabiano Fidêncio <fidencio(a)redhat.com>
5de385f (Jakub Hrozek, 6 weeks ago)
CONFIG: List allowed secrets responder options
Co-author: Fabiano Fidêncio <fidencio(a)redhat.com>
1f51d50 (Fabiano Fidêncio, 11 hours ago)
CONFIG: Add secrets responder to the allowed sections
Signed-off-by: Fabiano Fidêncio <fidencio(a)redhat.com>
In the last patch (f587a7c) I'm adding a test for the maximum depth,
but I decided to, at least for now, do this test based on the default
value set for this option instead of trying to implemenet something in
python to read the config entries from the ConfDB file.
"""
To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/33/head:pr33
git checkout pr33
7 years, 5 months
[PATCH ding-libs] Extend API to const key for clients that don't need to modify their keys
by Philip Prindeville
From: Philip Prindeville <philipp(a)fedoraproject.org>
Add c_str as a "const char *" to the hash_key_t.
Redux per comments from Michal Zidek.
---
dhash/dhash.c | 29 +++++++++++++++++++++--------
dhash/dhash.h | 4 +++-
dhash/examples/dhash_test.c | 3 +++
3 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/dhash/dhash.c b/dhash/dhash.c
index 45ee0cf..98439e8 100644
--- a/dhash/dhash.c
+++ b/dhash/dhash.c
@@ -176,7 +176,7 @@ static void sys_free_wrapper(void *ptr, void *pvt)
static address_t convert_key(hash_key_t *key)
{
address_t h;
- unsigned char *k;
+ const unsigned char *k;
switch(key->type) {
case HASH_KEY_ULONG:
@@ -184,7 +184,12 @@ static address_t convert_key(hash_key_t *key)
break;
case HASH_KEY_STRING:
/* Convert string to integer */
- for (h = 0, k = (unsigned char *) key->str; *k; k++)
+ for (h = 0, k = (const unsigned char *) key->str; *k; k++)
+ h = h * PRIME_1 ^ (*k - ' ');
+ break;
+ case HASH_KEY_CONST_STRING:
+ /* Convert string to integer */
+ for (h = 0, k = (const unsigned char *) key->c_str; *k; k++)
h = h * PRIME_1 ^ (*k - ' ');
break;
default:
@@ -212,6 +217,7 @@ static bool is_valid_key_type(hash_key_enum key_type)
switch(key_type) {
case HASH_KEY_ULONG:
case HASH_KEY_STRING:
+ case HASH_KEY_CONST_STRING:
return true;
default:
return false;
@@ -244,6 +250,8 @@ static bool key_equal(hash_key_t *a, hash_key_t *b)
return (a->ul == b->ul);
case HASH_KEY_STRING:
return (strcmp(a->str, b->str) == 0);
+ case HASH_KEY_CONST_STRING:
+ return (strcmp(a->c_str, b->c_str) == 0);
}
return false;
}
@@ -670,8 +678,11 @@ int hash_destroy(hash_table_t *table)
while (p != NULL) {
q = p->next;
hdelete_callback(table, HASH_TABLE_DESTROY, &p->entry);
- if (p->entry.key.type == HASH_KEY_STRING) {
- hfree(table, (char *)p->entry.key.str);
+ if (p->entry.key.type == HASH_KEY_STRING
+ || p->entry.key.type == HASH_KEY_CONST_STRING) {
+ /* Internally we do not use constant memory for keys
+ * in hash table elements. */
+ hfree(table, p->entry.key.str);
}
hfree(table, (char *)p);
p = q;
@@ -972,13 +983,14 @@ int hash_enter(hash_table_t *table, hash_key_t *key, hash_value_t *value)
element->entry.key.ul = key->ul;
break;
case HASH_KEY_STRING:
- len = strlen(key->str)+1;
+ case HASH_KEY_CONST_STRING:
+ len = strlen(key->c_str) + 1;
element->entry.key.str = halloc(table, len);
if (element->entry.key.str == NULL) {
hfree(table, element);
return HASH_ERROR_NO_MEMORY;
}
- memcpy((void *)element->entry.key.str, key->str, len);
+ memcpy(element->entry.key.str, key->str, len);
break;
}
@@ -1070,8 +1082,9 @@ int hash_delete(hash_table_t *table, hash_key_t *key)
return error;
}
}
- if (element->entry.key.type == HASH_KEY_STRING) {
- hfree(table, (char *)element->entry.key.str);
+ if (element->entry.key.type == HASH_KEY_STRING
+ || element->entry.key.type == HASH_KEY_CONST_STRING) {
+ hfree(table, element->entry.key.str);
}
hfree(table, element);
return HASH_SUCCESS;
diff --git a/dhash/dhash.h b/dhash/dhash.h
index baa0d6a..c36ab79 100644
--- a/dhash/dhash.h
+++ b/dhash/dhash.h
@@ -112,7 +112,8 @@ typedef struct hash_table_str hash_table_t;
typedef enum {
HASH_KEY_STRING,
- HASH_KEY_ULONG
+ HASH_KEY_ULONG,
+ HASH_KEY_CONST_STRING
} hash_key_enum;
typedef enum
@@ -137,6 +138,7 @@ typedef struct hash_key_t {
hash_key_enum type;
union {
char *str;
+ const char *c_str;
unsigned long ul;
};
} hash_key_t;
diff --git a/dhash/examples/dhash_test.c b/dhash/examples/dhash_test.c
index 303e9f8..7613e23 100644
--- a/dhash/examples/dhash_test.c
+++ b/dhash/examples/dhash_test.c
@@ -64,6 +64,9 @@ static char *key_string(hash_key_t *key)
case HASH_KEY_STRING:
snprintf(buf, sizeof(buf), "key string = \"%s\"", key->str);
break;
+ case HASH_KEY_CONST_STRING:
+ snprintf(buf, sizeof(buf), "key string = \"%s\"", key->c_str);
+ break;
default:
snprintf(buf, sizeof(buf), "unknown key type = %d", key->type);
break;
--
2.7.4
7 years, 5 months
[sssd PR#36][opened] Partial fix for #3169
by fidencio
URL: https://github.com/SSSD/sssd/pull/36
Author: fidencio
Title: #36: Partial fix for #3169
Action: opened
PR body:
"""
Ticket #3169 is about having a quota for sssd secrets.
This quota depends basically on the number of stored secrets and the size
of (the payload of the) each stored secret and this patch implements the
former for now.
This patch is rebased on top of the series that fixes #3168.
Relevant Patches:
1e4e914 (Fabiano Fidêncio, 17 minutes ago)
SECRETS: Add a configurable limit of secrets that can be stored
Related: https://fedorahosted.org/sssd/ticket/3169
"""
To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/36/head:pr36
git checkout pr36
7 years, 5 months