Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/rofl0r/proxychains-ng.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrofl0r <retnyg@gmx.net>2011-11-06 20:47:44 +0400
committerrofl0r <retnyg@gmx.net>2011-11-06 20:47:44 +0400
commit6ac6abd3deca47dd9e06fba58c415e0af098934e (patch)
tree4701153d54170ae92fc37a3e2efbadd3280d7eaf
parent41e73ab58d2fa2bf047b93fd88d65e4a888836e6 (diff)
add possibility to search for DLL in exe's path
-rw-r--r--src/main.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index e63ecf5..b7c5581 100644
--- a/src/main.c
+++ b/src/main.c
@@ -41,8 +41,10 @@ int check_path(char* path) {
static const char* dll_name = "libproxychains4.so";
+static char own_dir[256];
static const char* dll_dirs[] = {
".",
+ own_dir,
LIB_DIR,
"/lib",
"/usr/lib",
@@ -51,6 +53,17 @@ static const char* dll_dirs[] = {
NULL
};
+static void set_own_dir(const char* argv0) {
+ size_t l = strlen(argv0);
+ while(l && argv0[l - 1] != '/') l--;
+ if(l == 0)
+ memcpy(own_dir, ".", 2);
+ else {
+ memcpy(own_dir, argv0, l - 1);
+ own_dir[l] = 0;
+ }
+}
+
int main(int argc, char *argv[]) {
char *path = NULL;
char buf[256];
@@ -114,6 +127,8 @@ int main(int argc, char *argv[]) {
size_t i = 0;
const char* prefix = NULL;
+ set_own_dir(argv[0]);
+
while(dll_dirs[i]) {
snprintf(buf, sizeof(buf), "%s/%s", dll_dirs[i], dll_name);
if(access(buf, R_OK) != -1) {