about summary refs log tree commit diff
path: root/src/libnsss/nsss_unix_getpwnam.c
blob: eb5d6b11eca4256af339ad975760cccf23038096 (plain) (blame)
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_getpwnam (char const *name)
{
  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_getbyname(&a, &nsss_pwd_here, &nsss_pwd_sa_here, name))
  {
    nsss_unix_pwd_end(&a) ;
    return 0 ;
  }
  nsss_unix_pwd_end(&a) ;
  return &nsss_pwd_here ;
}