summaryrefslogtreecommitdiff
path: root/src/libnsss/nsss_unix_getpwuid.c
blob: 35f019d7b398078182a993b04161f25f816b1d5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* ISC license. */

#include <nsss/pwd-unix.h>
#include <nsss/nsss-unix.h>
#include "nsss-internal.h"

struct passwd *nsss_unix_getpwuid (uid_t uid)
{
  nsss_unix_t a = NSSS_UNIX_ZERO ;
  if (!nsss_unix_pwd_start(&a)) return 0 ;
  nsss_pwd_sa_here.len = 0 ;
  if (!nsss_unix_pwd_getbyuid(&a, &nsss_pwd_here, &nsss_pwd_sa_here, uid))
  {
    nsss_unix_pwd_end(&a) ;
    return 0 ;
  }
  nsss_unix_pwd_end(&a) ;
  return &nsss_pwd_here ;
}