]> git.pld-linux.org Git - packages/cyrus-sasl.git/blame - 0030-dont_use_la_files_for_opening_plugins.patch
- add db 5.3 and 5.2 to the search list
[packages/cyrus-sasl.git] / 0030-dont_use_la_files_for_opening_plugins.patch
CommitLineData
cdd7a95b
JR
1--- a/lib/dlopen.c
2+++ b/lib/dlopen.c
3@@ -247,105 +247,6 @@ static int _sasl_plugin_load(char *plugi
4 return result;
5 }
6
7-/* this returns the file to actually open.
8- * out should be a buffer of size PATH_MAX
9- * and may be the same as in. */
10-
11-/* We'll use a static buffer for speed unless someone complains */
12-#define MAX_LINE 2048
13-
14-static int _parse_la(const char *prefix, const char *in, char *out)
15-{
16- FILE *file;
17- size_t length;
18- char line[MAX_LINE];
19- char *ntmp = NULL;
20-
21- if(!in || !out || !prefix || out == in) return SASL_BADPARAM;
22-
23- /* Set this so we can detect failure */
24- *out = '\0';
25-
26- length = strlen(in);
27-
28- if (strcmp(in + (length - strlen(LA_SUFFIX)), LA_SUFFIX)) {
29- if(!strcmp(in + (length - strlen(SO_SUFFIX)),SO_SUFFIX)) {
30- /* check for a .la file */
31- strcpy(line, prefix);
32- strcat(line, in);
33- length = strlen(line);
34- *(line + (length - strlen(SO_SUFFIX))) = '\0';
35- strcat(line, LA_SUFFIX);
36- file = fopen(line, "r");
37- if(file) {
38- /* We'll get it on the .la open */
39- fclose(file);
40- return SASL_FAIL;
41- }
42- }
43- strcpy(out, prefix);
44- strcat(out, in);
45- return SASL_OK;
46- }
47-
48- strcpy(line, prefix);
49- strcat(line, in);
50-
51- file = fopen(line, "r");
52- if(!file) {
53- _sasl_log(NULL, SASL_LOG_WARN,
54- "unable to open LA file: %s", line);
55- return SASL_FAIL;
56- }
57-
58- while(!feof(file)) {
59- if(!fgets(line, MAX_LINE, file)) break;
60- if(line[strlen(line) - 1] != '\n') {
61- _sasl_log(NULL, SASL_LOG_WARN,
62- "LA file has too long of a line: %s", in);
63- return SASL_BUFOVER;
64- }
65- if(line[0] == '\n' || line[0] == '#') continue;
66- if(!strncmp(line, "dlname=", sizeof("dlname=") - 1)) {
67- /* We found the line with the name in it */
68- char *end;
69- char *start;
70- size_t len;
71- end = strrchr(line, '\'');
72- if(!end) continue;
73- start = &line[sizeof("dlname=")-1];
74- len = strlen(start);
75- if(len > 3 && start[0] == '\'') {
76- ntmp=&start[1];
77- *end='\0';
78- /* Do we have dlname="" ? */
79- if(ntmp == end) {
80- _sasl_log(NULL, SASL_LOG_DEBUG,
81- "dlname is empty in .la file: %s", in);
82- return SASL_FAIL;
83- }
84- strcpy(out, prefix);
85- strcat(out, ntmp);
86- }
87- break;
88- }
89- }
90- if(ferror(file) || feof(file)) {
91- _sasl_log(NULL, SASL_LOG_WARN,
92- "Error reading .la: %s\n", in);
93- fclose(file);
94- return SASL_FAIL;
95- }
96- fclose(file);
97-
98- if(!(*out)) {
99- _sasl_log(NULL, SASL_LOG_WARN,
100- "Could not find a dlname line in .la file: %s", in);
101- return SASL_FAIL;
102- }
103-
104- return SASL_OK;
105-}
106 #endif /* DO_DLOPEN */
107
108 /* loads a plugin library */
109@@ -499,18 +400,18 @@ int _sasl_load_plugins(const add_plugin_
110 if (length + pos>=PATH_MAX) continue; /* too big */
111
112 if (strcmp(dir->d_name + (length - strlen(SO_SUFFIX)),
113- SO_SUFFIX)
114- && strcmp(dir->d_name + (length - strlen(LA_SUFFIX)),
115- LA_SUFFIX))
116+ SO_SUFFIX))
117 continue;
118
119+ /* We only use .so files for loading plugins */
120+
121 memcpy(name,dir->d_name,length);
122 name[length]='\0';
123
124- result = _parse_la(prefix, name, tmp);
125- if(result != SASL_OK)
126- continue;
127-
128+ /* Create full name with path */
129+ strncpy(tmp, prefix, PATH_MAX);
130+ strncat(tmp, name, PATH_MAX);
131+
132 /* skip "lib" and cut off suffix --
133 this only need be approximate */
134 strcpy(plugname, name + 3);
This page took 0.039794 seconds and 4 git commands to generate.