LCOV - differential code coverage report
Current view: top level - src/test/modules/ldap_password_func - ldap_password_func.c (source / functions) Coverage Total Hit UBC
Current: c70b6db34ffeab48beef1fb4ce61bcad3772b8dd vs 06473f5a344df8c9594ead90a609b86f6724cff8 Lines: 0.0 % 15 0 15
Current Date: 2025-09-06 07:49:51 +0900 Functions: 0.0 % 3 0 3
Baseline: lcov-20250906-005545-baseline Branches: 0.0 % 18 0 18
Baseline Date: 2025-09-05 08:21:35 +0100 Line coverage date bins:
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
(360..) days: 0.0 % 15 0 15
Function coverage date bins:
(360..) days: 0.0 % 3 0 3
Branch coverage date bins:
(360..) days: 0.0 % 18 0 18

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /*-------------------------------------------------------------------------
                                  2                 :                :  *
                                  3                 :                :  * Copyright (c) 2022-2025, PostgreSQL Global Development Group
                                  4                 :                :  *
                                  5                 :                :  * ldap_password_func.c
                                  6                 :                :  *
                                  7                 :                :  * Loadable PostgreSQL module to mutate the ldapbindpasswd. This
                                  8                 :                :  * implementation just hands back the configured password rot13'd.
                                  9                 :                :  *
                                 10                 :                :  *-------------------------------------------------------------------------
                                 11                 :                :  */
                                 12                 :                : 
                                 13                 :                : #include "postgres.h"
                                 14                 :                : 
                                 15                 :                : #include <float.h>
                                 16                 :                : #include <stdio.h>
                                 17                 :                : 
                                 18                 :                : #include "fmgr.h"
                                 19                 :                : #include "libpq/auth.h"
                                 20                 :                : 
  906 andrew@dunslane.net        21                 :UBC           0 : PG_MODULE_MAGIC;
                                 22                 :                : 
                                 23                 :                : void        _PG_init(void);
                                 24                 :                : 
                                 25                 :                : /* hook function */
                                 26                 :                : static char *rot13_passphrase(char *password);
                                 27                 :                : 
                                 28                 :                : /*
                                 29                 :                :  * Module load callback
                                 30                 :                :  */
                                 31                 :                : void
                                 32                 :              0 : _PG_init(void)
                                 33                 :                : {
                                 34                 :              0 :     ldap_password_hook = rot13_passphrase;
                                 35                 :              0 : }
                                 36                 :                : 
                                 37                 :                : static char *
                                 38                 :              0 : rot13_passphrase(char *pw)
                                 39                 :                : {
                                 40                 :              0 :     size_t      size = strlen(pw) + 1;
                                 41                 :                : 
                                 42                 :              0 :     char       *new_pw = (char *) palloc(size);
                                 43                 :                : 
                                 44                 :              0 :     strlcpy(new_pw, pw, size);
                                 45         [ #  # ]:              0 :     for (char *p = new_pw; *p; p++)
                                 46                 :                :     {
                                 47                 :              0 :         char        c = *p;
                                 48                 :                : 
                                 49   [ #  #  #  #  :              0 :         if ((c >= 'a' && c <= 'm') || (c >= 'A' && c <= 'M'))
                                        #  #  #  # ]
                                 50                 :              0 :             *p = c + 13;
                                 51   [ #  #  #  #  :              0 :         else if ((c >= 'n' && c <= 'z') || (c >= 'N' && c <= 'Z'))
                                        #  #  #  # ]
                                 52                 :              0 :             *p = c - 13;
                                 53                 :                :     }
                                 54                 :                : 
                                 55                 :              0 :     return new_pw;
                                 56                 :                : }
        

Generated by: LCOV version 2.4-beta