chiark / gitweb /
debianutils: Update from 4.8.3 to 4.8.4
[termux-packages] / packages / tsocks / 05_config_in_home.patch
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 05_config_in_home.dpatch by Reinhard Tartler <siretart@tauware.de>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: Additionally search for the configuration file in user home directory
6
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
10 @@ -36,6 +36,32 @@
11  static int handle_defpass(struct parsedfile *, int, char *);
12  static int make_netent(char *value, struct netent **ent);
13  
14 +char __attribute__ ((visibility ("hidden")))
15 +*find_config(char *line) {
16 +       struct passwd* pw;
17 +
18 +       errno = 0;
19 +
20 +       pw = getpwuid(getuid());
21 +       if (errno) {
22 +               perror("getpwuid");
23 +               return NULL;
24 +       }
25 +
26 +       /* check for config in $HOME */
27 +       snprintf(line, MAXLINE - 1, "%s/.tsocks.conf", pw->pw_dir);
28 +
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);
32 +       }
33 +
34 +       /* Insure null termination */
35 +       line[MAXLINE - 1] = (char) 0;
36 +
37 +       return line;
38 +}
39 +
40  int __attribute__ ((visibility ("hidden")))
41  read_config (char *filename, struct parsedfile *config) {
42         FILE *conf;