1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 05_config_in_home.dpatch by Reinhard Tartler <siretart@tauware.de>
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: Additionally search for the configuration file in user home directory
7 diff -urNad tsocks-1.8beta5~/parser.c tsocks-1.8beta5/parser.c
8 --- tsocks-1.8beta5~/parser.c 2008-03-03 14:05:14.000000000 +0100
9 +++ tsocks-1.8beta5/parser.c 2008-03-03 14:05:36.000000000 +0100
11 static int handle_defpass(struct parsedfile *, int, char *);
12 static int make_netent(char *value, struct netent **ent);
14 +char __attribute__ ((visibility ("hidden")))
15 +*find_config(char *line) {
20 + pw = getpwuid(getuid());
26 + /* check for config in $HOME */
27 + snprintf(line, MAXLINE - 1, "%s/.tsocks.conf", pw->pw_dir);
29 + if (access(line, R_OK)) {
30 + show_msg(MSGDEBUG, "Can't access %s, using " CONF_FILE " instead.\n", line);
31 + strncpy(line, CONF_FILE, MAXLINE - 1);
34 + /* Insure null termination */
35 + line[MAXLINE - 1] = (char) 0;
40 int __attribute__ ((visibility ("hidden")))
41 read_config (char *filename, struct parsedfile *config) {