3 @@ -247,105 +247,6 @@ static int _sasl_plugin_load(char *plugi
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. */
11 -/* We'll use a static buffer for speed unless someone complains */
12 -#define MAX_LINE 2048
14 -static int _parse_la(const char *prefix, const char *in, char *out)
18 - char line[MAX_LINE];
21 - if(!in || !out || !prefix || out == in) return SASL_BADPARAM;
23 - /* Set this so we can detect failure */
26 - length = strlen(in);
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);
33 - length = strlen(line);
34 - *(line + (length - strlen(SO_SUFFIX))) = '\0';
35 - strcat(line, LA_SUFFIX);
36 - file = fopen(line, "r");
38 - /* We'll get it on the .la open */
43 - strcpy(out, prefix);
48 - strcpy(line, prefix);
51 - file = fopen(line, "r");
53 - _sasl_log(NULL, SASL_LOG_WARN,
54 - "unable to open LA file: %s", line);
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;
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 */
71 - end = strrchr(line, '\'');
73 - start = &line[sizeof("dlname=")-1];
74 - len = strlen(start);
75 - if(len > 3 && start[0] == '\'') {
78 - /* Do we have dlname="" ? */
80 - _sasl_log(NULL, SASL_LOG_DEBUG,
81 - "dlname is empty in .la file: %s", in);
84 - strcpy(out, prefix);
90 - if(ferror(file) || feof(file)) {
91 - _sasl_log(NULL, SASL_LOG_WARN,
92 - "Error reading .la: %s\n", in);
99 - _sasl_log(NULL, SASL_LOG_WARN,
100 - "Could not find a dlname line in .la file: %s", in);
106 #endif /* DO_DLOPEN */
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 */
112 if (strcmp(dir->d_name + (length - strlen(SO_SUFFIX)),
114 - && strcmp(dir->d_name + (length - strlen(LA_SUFFIX)),
119 + /* We only use .so files for loading plugins */
121 memcpy(name,dir->d_name,length);
124 - result = _parse_la(prefix, name, tmp);
125 - if(result != SASL_OK)
128 + /* Create full name with path */
129 + strncpy(tmp, prefix, PATH_MAX);
130 + strncat(tmp, name, PATH_MAX);
132 /* skip "lib" and cut off suffix --
133 this only need be approximate */
134 strcpy(plugname, name + 3);