5 mboxfile(dest *dp, String *user, String *path, char *file)
9 mboxpath(s_to_c(user), s_to_c(dp->addr), path, 0);
10 cp = strrchr(s_to_c(path), '/');
14 path->ptr = path->base;
19 * Check forwarding requests
22 expand_local(dest *dp)
25 String *file, *line, *s;
30 /* short circuit obvious security problems */
31 if(strstr(s_to_c(dp->addr), "/../")){
32 dp->status = d_unknown;
36 /* isolate user's name if part of a path */
37 user = strrchr(s_to_c(dp->addr), '!');
41 user = s_to_c(dp->addr);
43 /* if no replacement string, plug in user's name */
46 mboxname(user, dp->repl1);
49 s = unescapespecial(s_clone(dp->repl1));
52 * if this is the descendant of a `forward' file, don't
56 for(rv = dp->parent; rv; rv = rv->parent)
57 if(rv->status == d_cat){
64 * look for `forward' file for forwarding address(es)
66 mboxfile(dp, s, file, "forward");
67 fp = sysopen(s_to_c(file), "r", 0);
71 if(s_read_line(fp, line) == nil)
73 if(*(line->ptr - 1) != '\n')
75 if(*(line->ptr - 2) == '\\')
81 fprint(2, "forward = %s\n", s_to_c(line));
82 rv = s_to_dest(s_restart(line), dp);
93 * look for a 'pipe' file. This won't work if there are
94 * special characters in the account name since the file
95 * name passes through a shell. tdb.
97 mboxfile(dp, dp->repl1, s_reset(file), "pipeto");
98 if(sysexist(s_to_c(file))){
100 fprint(2, "found a pipeto file\n");
101 dp->status = d_pipeto;
103 s_append(line, "upasname='");
104 s_append(line, user);
105 s_append(line, "' ");
106 s_append(line, s_to_c(file));
108 s_append(line, s_to_c(dp->addr));
110 s_append(line, s_to_c(dp->repl1));
119 * see if the mailbox directory exists
121 mboxfile(dp, s, s_reset(file), ".");
122 if(sysexist(s_to_c(file)))
125 dp->status = d_unknown;