コード例 #1
0
ファイル: passwd.c プロジェクト: silkentrance/nss-pam-ldap
/* read a passwd entry from the stream */
static nss_status_t read_passwd(
        TFILE *fp,struct passwd *result,
        char *buffer,size_t buflen,int *errnop)
{
  int32_t tmpint32;
  size_t bufptr=0;
  READ_BUF_STRING(fp,result->pw_name);
  READ_BUF_STRING(fp,result->pw_passwd);
  READ_TYPE(fp,result->pw_uid,uid_t);
  READ_TYPE(fp,result->pw_gid,gid_t);
  READ_BUF_STRING(fp,result->pw_gecos);
  READ_BUF_STRING(fp,result->pw_dir);
  READ_BUF_STRING(fp,result->pw_shell);
  return NSS_STATUS_SUCCESS;
}
コード例 #2
0
ファイル: pam.c プロジェクト: silkentrance/nss-pam-ldap
/* check whether the specified user is handled by nslcd */
static int nslcd_request_exists(pam_handle_t *pamh,struct pld_ctx *ctx,struct pld_cfg *cfg,
                                const char *username)
{
  uid_t dummy_uid;
  gid_t dummy_gid;
  PAM_REQUEST(NSLCD_ACTION_PASSWD_BYNAME,
    /* log debug message */
    pam_syslog(pamh,LOG_DEBUG,"nslcd account check; user=%s",username),
    /* write the request parameters */
    WRITE_STRING(fp,username),
    /* read the result entry */
    SKIP_STRING(fp); /* user name */
    SKIP_STRING(fp); /* passwd entry */
    READ_TYPE(fp,dummy_uid,uid_t);
    READ_TYPE(fp,dummy_gid,gid_t);
    SKIP_STRING(fp); /* gecos */
    SKIP_STRING(fp); /* home dir */
    SKIP_STRING(fp); /* shell */
  )
}
コード例 #3
0
/* read the version information and action from the stream
   this function returns the read action in location pointer to by action */
static int read_header(TFILE *fp,int32_t *action)
{
  int32_t tmpint32;
  /* read the protocol version */
  READ_TYPE(fp,tmpint32,int32_t);
  if (tmpint32 != (int32_t)NSLCD_VERSION)
  {
    Debug( LDAP_DEBUG_TRACE,"nssov: wrong nslcd version id (%d)\n",(int)tmpint32,0,0);
    return -1;
  }
  /* read the request type */
  READ(fp,action,sizeof(int32_t));
  return 0;
}
コード例 #4
0
ファイル: services.c プロジェクト: silkentrance/nss-pam-ldap
/* read a single services result entry from the stream */
static nss_status_t read_servent(
        TFILE *fp,struct servent *result,
        char *buffer,size_t buflen,int *errnop)
{
  int32_t tmpint32,tmp2int32,tmp3int32;
  size_t bufptr=0;
  READ_BUF_STRING(fp,result->s_name);
  READ_BUF_STRINGLIST(fp,result->s_aliases);
  /* store port number in network byte order */
  READ_TYPE(fp,tmpint32,int32_t);
  result->s_port=htons((uint16_t)tmpint32);
  READ_BUF_STRING(fp,result->s_proto);
  /* we're done */
  return NSS_STATUS_SUCCESS;
}