76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
-
+
|
for (i=0;i<256;i++) {
if (modules[i]!=NULL)
dlclose(modules[i]);
}
return(DACT_MOD_OK);
}
int load_modules_all(const char *options) {
int load_modules_all(const unsigned char *options) {
#ifdef HAVE_DIRENT_H
struct dirent *dinfo;
char *mdircpy, *tmpbuf, *mbuf, *fname, fullfname[1024];
DIR *dirtype;
mdircpy=parse_url_subst(moduledirectory, "");
mbuf=mdircpy;
|
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
-
+
-
+
-
+
|
free(mdircpy);
#else
PRINTERR("I don't know how to handle this.")
#endif
return(DACT_MOD_OK);
}
int load_module (char *modulename, const char *options) {
int load_module (char *modulename, const unsigned char *options) {
char modulefile[256], *tmpbuf, *mbuf, *mdircpy;
void *mh=NULL;
uint32_t algo_num, module_type=DACT_MOD_TYPE_COMP;
uint32_t dc_ver=0, dc_req=0, dact_ver;
char *dc_url_get=NULL, *dc_url_ver=NULL, *dc_sign=NULL;
if (strchr(modulename,'/')==NULL) {
mdircpy=parse_url_subst(moduledirectory, "");
mbuf=mdircpy;
while ((tmpbuf=strsep(&mbuf, ":"))) {
snprintf(modulefile, sizeof(modulefile)-1, "%s/%s.so",tmpbuf,modulename);
if ((mh=dlopen(modulefile, RTLD_GLOBAL|RTLD_LAZY))!=NULL) break;
if ((mh=dlopen(modulefile, RTLD_GLOBAL|RTLD_NOW))!=NULL) break;
}
free(mdircpy);
} else {
strncpy(modulefile, modulename, sizeof(modulefile)-1);
if ((mh=dlopen(modulefile, RTLD_GLOBAL|RTLD_LAZY))==NULL) {
if ((mh=dlopen(modulefile, RTLD_GLOBAL|RTLD_NOW))==NULL) {
PRINTERR("Could not load module.");
return(DACT_MOD_FAIL);
}
}
if (!mh) return(DACT_MOD_FAIL);
if (dlsym(mh,"DC_NUM")==NULL \
|
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
-
+
|
}
break;
}
}
if (modules_count>255) {
if (modules_count<255) {
modules[modules_count++]=mh;
}
switch (module_type) {
case DACT_MOD_TYPE_COMP:
if (algo_num>=((sizeof(algorithms))/(sizeof(*algorithms)))) return(DACT_MOD_FAIL);
|
222
223
224
225
226
227
228
229
230
231
232
233
234
|
222
223
224
225
226
227
228
229
230
231
232
233
234
|
-
-
+
+
|
char moduledirectory[2048] = ".";
void *modules[256];
int modules_initialized = 0;
int modules_count = 0;
int init_modules(void) { return(DACT_MOD_FAIL); }
int unload_modules(void) { return(DACT_MOD_FAIL); }
int load_module(char *modulename, const char *options) { return(DACT_MOD_FAIL); }
int load_modules_all(const char *options) { return(DACT_MOD_FAIL); }
int load_module(char *modulename, const unsigned char *options) { return(DACT_MOD_FAIL); }
int load_modules_all(const unsigned char *options) { return(DACT_MOD_FAIL); }
#endif
|