diff options
Diffstat (limited to 'src/shared/user-record-nss.c')
-rw-r--r-- | src/shared/user-record-nss.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c index 88b8fc2f8f..ea1bc9faac 100644 --- a/src/shared/user-record-nss.c +++ b/src/shared/user-record-nss.c @@ -44,7 +44,6 @@ int nss_passwd_to_user_record( int r; assert(pwd); - assert(ret); if (isempty(pwd->pw_name)) return -EINVAL; @@ -161,7 +160,8 @@ int nss_passwd_to_user_record( hr->mask = USER_RECORD_REGULAR | (!strv_isempty(hr->hashed_password) ? USER_RECORD_PRIVILEGED : 0); - *ret = TAKE_PTR(hr); + if (ret) + *ret = TAKE_PTR(hr); return 0; } @@ -216,7 +216,6 @@ int nss_user_record_by_name( int r; assert(name); - assert(ret); for (;;) { buf = malloc(buflen); @@ -257,7 +256,8 @@ int nss_user_record_by_name( if (r < 0) return r; - (*ret)->incomplete = incomplete; + if (ret) + (*ret)->incomplete = incomplete; return 0; } @@ -273,8 +273,6 @@ int nss_user_record_by_uid( struct spwd spwd, *sresult = NULL; int r; - assert(ret); - for (;;) { buf = malloc(buflen); if (!buf) @@ -313,7 +311,8 @@ int nss_user_record_by_uid( if (r < 0) return r; - (*ret)->incomplete = incomplete; + if (ret) + (*ret)->incomplete = incomplete; return 0; } @@ -326,7 +325,6 @@ int nss_group_to_group_record( int r; assert(grp); - assert(ret); if (isempty(grp->gr_name)) return -EINVAL; @@ -376,7 +374,8 @@ int nss_group_to_group_record( g->mask = USER_RECORD_REGULAR | (!strv_isempty(g->hashed_password) ? USER_RECORD_PRIVILEGED : 0); - *ret = TAKE_PTR(g); + if (ret) + *ret = TAKE_PTR(g); return 0; } @@ -431,7 +430,6 @@ int nss_group_record_by_name( int r; assert(name); - assert(ret); for (;;) { buf = malloc(buflen); @@ -471,7 +469,8 @@ int nss_group_record_by_name( if (r < 0) return r; - (*ret)->incomplete = incomplete; + if (ret) + (*ret)->incomplete = incomplete; return 0; } @@ -487,8 +486,6 @@ int nss_group_record_by_gid( struct sgrp sgrp, *sresult = NULL; int r; - assert(ret); - for (;;) { buf = malloc(buflen); if (!buf) @@ -526,6 +523,7 @@ int nss_group_record_by_gid( if (r < 0) return r; - (*ret)->incomplete = incomplete; + if (ret) + (*ret)->incomplete = incomplete; return 0; } |