PostgreSQL Source Code  git master
ldap_password_func.c File Reference
#include "postgres.h"
#include <float.h>
#include <stdio.h>
#include "libpq/auth.h"
#include "libpq/libpq.h"
#include "libpq/libpq-be.h"
#include "utils/guc.h"
Include dependency graph for ldap_password_func.c:

Go to the source code of this file.

Functions

void _PG_init (void)
 
void _PG_fini (void)
 
static char * rot13_passphrase (char *password)
 

Variables

 PG_MODULE_MAGIC
 

Function Documentation

◆ _PG_fini()

void _PG_fini ( void  )

Definition at line 41 of file ldap_password_func.c.

42 {
43  /* do nothing yet */
44 }

◆ _PG_init()

void _PG_init ( void  )

Definition at line 35 of file ldap_password_func.c.

36 {
38 }
PGDLLIMPORT auth_password_hook_typ ldap_password_hook
static char * rot13_passphrase(char *password)

References ldap_password_hook, and rot13_passphrase().

◆ rot13_passphrase()

static char * rot13_passphrase ( char *  password)
static

Definition at line 47 of file ldap_password_func.c.

48 {
49  size_t size = strlen(pw) + 1;
50 
51  char *new_pw = (char *) palloc(size);
52 
53  strlcpy(new_pw, pw, size);
54  for (char *p = new_pw; *p; p++)
55  {
56  char c = *p;
57 
58  if ((c >= 'a' && c <= 'm') || (c >= 'A' && c <= 'M'))
59  *p = c + 13;
60  else if ((c >= 'n' && c <= 'z') || (c >= 'N' && c <= 'Z'))
61  *p = c - 13;
62  }
63 
64  return new_pw;
65 }
void * palloc(Size size)
Definition: mcxt.c:1304
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: strlcpy.c:45
char * c
static pg_noinline void Size size
Definition: slab.c:607

References palloc(), size, and strlcpy().

Referenced by _PG_init().

Variable Documentation

◆ PG_MODULE_MAGIC

PG_MODULE_MAGIC

Definition at line 23 of file ldap_password_func.c.