Browse code

ldap: clang format the code

Daniel-Constantin Mierla authored on 28/11/2017 16:51:33
Showing 1 changed files
... ...
@@ -34,19 +34,20 @@
34 34
 #include "iniparser.h"
35 35
 
36 36
 
37
-struct ld_session {
38
-	char                    name[256];
39
-	LDAP*                   handle;
40
-	char*                   host_name;
41
-	int                     version;
42
-	int                     server_search_timeout;
43
-	struct timeval          client_search_timeout;
44
-	struct timeval		client_bind_timeout;
45
-	struct timeval          network_timeout;
46
-	char*                   bind_dn;
47
-	char*                   bind_pwd;
48
-	int                     calculate_ha1;
49
-	struct ld_session*      next;
37
+struct ld_session
38
+{
39
+	char name[256];
40
+	LDAP *handle;
41
+	char *host_name;
42
+	int version;
43
+	int server_search_timeout;
44
+	struct timeval client_search_timeout;
45
+	struct timeval client_bind_timeout;
46
+	struct timeval network_timeout;
47
+	char *bind_dn;
48
+	char *bind_pwd;
49
+	int calculate_ha1;
50
+	struct ld_session *next;
50 51
 };
51 52
 
52 53
 #define CFG_N_LDAP_HOST "ldap_server_url"
... ...
@@ -72,11 +73,10 @@ struct ld_session {
72 73
 
73 74
 #define CFG_LDAP_CLIENT_SEARCH_TIMEOUT_MIN 2000
74 75
 
75
-extern int add_ld_session(char* _name, LDAP* _ldh, dictionary* _d);
76
-extern struct ld_session* get_ld_session(char* _name);
76
+extern int add_ld_session(char *_name, LDAP *_ldh, dictionary *_d);
77
+extern struct ld_session *get_ld_session(char *_name);
77 78
 extern int free_ld_sessions(void);
78 79
 
79
-extern char* get_ini_key_name(char* _section, char* _key);
80
+extern char *get_ini_key_name(char *_section, char *_key);
80 81
 
81 82
 #endif /* LD_SESSION_H */
82
-
Browse code

Add and fix #includes for more strict POSIX compliance

- sys/poll.h is non-standard, posix defines poll.h
- sys/time.h is needed in addition to time.h for e.g. struct timeval

Notable this fixes some build errors against musl libc

Timo Teräs authored on 28/04/2017 06:58:50
Showing 1 changed files
... ...
@@ -28,6 +28,7 @@
28 28
 #ifndef LD_SESSION_H
29 29
 #define LD_SESSION_H
30 30
 
31
+#include <sys/time.h>
31 32
 #include <ldap.h>
32 33
 
33 34
 #include "iniparser.h"
Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,81 @@
1
+/*
2
+* Kamailio LDAP Module
3
+*
4
+* Copyright (C) 2007 University of North Carolina
5
+*
6
+* Original author: Christian Schlatter, cs@unc.edu
7
+*
8
+*
9
+* This file is part of Kamailio, a free SIP server.
10
+*
11
+* Kamailio is free software; you can redistribute it and/or modify
12
+* it under the terms of the GNU General Public License as published by
13
+* the Free Software Foundation; either version 2 of the License, or
14
+* (at your option) any later version
15
+*
16
+* Kamailio is distributed in the hope that it will be useful,
17
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
+* GNU General Public License for more details.
20
+*
21
+* You should have received a copy of the GNU General Public License
22
+* along with this program; if not, write to the Free Software
23
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
24
+*
25
+*/
26
+
27
+
28
+#ifndef LD_SESSION_H
29
+#define LD_SESSION_H
30
+
31
+#include <ldap.h>
32
+
33
+#include "iniparser.h"
34
+
35
+
36
+struct ld_session {
37
+	char                    name[256];
38
+	LDAP*                   handle;
39
+	char*                   host_name;
40
+	int                     version;
41
+	int                     server_search_timeout;
42
+	struct timeval          client_search_timeout;
43
+	struct timeval		client_bind_timeout;
44
+	struct timeval          network_timeout;
45
+	char*                   bind_dn;
46
+	char*                   bind_pwd;
47
+	int                     calculate_ha1;
48
+	struct ld_session*      next;
49
+};
50
+
51
+#define CFG_N_LDAP_HOST "ldap_server_url"
52
+#define CFG_N_LDAP_VERSION "ldap_version"
53
+#define CFG_N_LDAP_SERVER_SEARCH_TIMEOUT "ldap_server_search_timeout"
54
+#define CFG_N_LDAP_CLIENT_SEARCH_TIMEOUT "ldap_client_search_timeout"
55
+#define CFG_N_LDAP_CLIENT_BIND_TIMEOUT "ldap_client_bind_timeout"
56
+#define CFG_N_LDAP_NETWORK_TIMEOUT "ldap_network_timeout"
57
+#define CFG_N_LDAP_BIND_DN "ldap_bind_dn"
58
+#define CFG_N_LDAP_BIND_PWD "ldap_bind_password"
59
+#define CFG_N_CALCULATE_HA1 "calculate_ha1"
60
+
61
+
62
+#define CFG_DEF_HOST_NAME ""
63
+#define CFG_DEF_LDAP_SERVER_URL NULL
64
+#define CFG_DEF_LDAP_VERSION 3
65
+#define CFG_DEF_LDAP_CLIENT_BIND_TIMEOUT 1000
66
+#define CFG_DEF_LDAP_CLIENT_SEARCH_TIMEOUT 5000
67
+#define CFG_DEF_LDAP_NETWORK_TIMEOUT 1000
68
+#define CFG_DEF_LDAP_BIND_DN ""
69
+#define CFG_DEF_LDAP_BIND_PWD ""
70
+#define CFG_DEF_CALCULATE_HA1 1
71
+
72
+#define CFG_LDAP_CLIENT_SEARCH_TIMEOUT_MIN 2000
73
+
74
+extern int add_ld_session(char* _name, LDAP* _ldh, dictionary* _d);
75
+extern struct ld_session* get_ld_session(char* _name);
76
+extern int free_ld_sessions(void);
77
+
78
+extern char* get_ini_key_name(char* _section, char* _key);
79
+
80
+#endif /* LD_SESSION_H */
81
+