* include/mailutils/mutil.h, mailbox/mutil.c (mu_normalize_path):
Remove useless second argument. All callers changed.
Showing
7 changed files
with
16 additions
and
15 deletions
1 | 2008-08-21 Sergey Poznyakoff <gray@gnu.org.ua> | 1 | 2008-08-21 Sergey Poznyakoff <gray@gnu.org.ua> |
2 | 2 | ||
3 | * include/mailutils/mutil.h, mailbox/mutil.c (mu_normalize_path): | ||
4 | Remove useless second argument. All uses changed. | ||
5 | |||
3 | Rewrite IMAP namespace support. | 6 | Rewrite IMAP namespace support. |
4 | * imap4d/imap4d.c (imap4d_cfg_param): other-namespace and | 7 | * imap4d/imap4d.c (imap4d_cfg_param): other-namespace and |
5 | shared-namespace take proper lists as arguments. | 8 | shared-namespace take proper lists as arguments. | ... | ... |
... | @@ -480,7 +480,7 @@ find_user (const char *name, char *tty) | ... | @@ -480,7 +480,7 @@ find_user (const char *name, char *tty) |
480 | sizeof (ftty) - sizeof (PATH_DEV) - 2); | 480 | sizeof (ftty) - sizeof (PATH_DEV) - 2); |
481 | ftty[sizeof (ftty) - 1] = 0; | 481 | ftty[sizeof (ftty) - 1] = 0; |
482 | 482 | ||
483 | mu_normalize_path (ftty, "/"); | 483 | mu_normalize_path (ftty); |
484 | if (strncmp (ftty, PATH_TTY_PFX, strlen (PATH_TTY_PFX))) | 484 | if (strncmp (ftty, PATH_TTY_PFX, strlen (PATH_TTY_PFX))) |
485 | { | 485 | { |
486 | /* An attempt to break security... */ | 486 | /* An attempt to break security... */ | ... | ... |
... | @@ -322,7 +322,7 @@ static struct mu_cfg_param imap4d_cfg_param[] = { | ... | @@ -322,7 +322,7 @@ static struct mu_cfg_param imap4d_cfg_param[] = { |
322 | int | 322 | int |
323 | imap4d_session_setup0 () | 323 | imap4d_session_setup0 () |
324 | { | 324 | { |
325 | homedir = mu_normalize_path (strdup (auth_data->dir), "/"); | 325 | homedir = mu_normalize_path (mu_strdup (auth_data->dir)); |
326 | if (imap4d_check_home_dir (homedir, auth_data->uid, auth_data->gid)) | 326 | if (imap4d_check_home_dir (homedir, auth_data->uid, auth_data->gid)) |
327 | return 1; | 327 | return 1; |
328 | 328 | ... | ... |
... | @@ -79,7 +79,6 @@ _enum_fun (void *item, void *data) | ... | @@ -79,7 +79,6 @@ _enum_fun (void *item, void *data) |
79 | static int | 79 | static int |
80 | namespace_enumerate (int id, nsfp_t f, void *closure) | 80 | namespace_enumerate (int id, nsfp_t f, void *closure) |
81 | { | 81 | { |
82 | int i, rc; | ||
83 | struct ns_closure nsc; | 82 | struct ns_closure nsc; |
84 | 83 | ||
85 | nsc.id = id; | 84 | nsc.id = id; |
... | @@ -238,7 +237,7 @@ namespace_init_session (char *path) | ... | @@ -238,7 +237,7 @@ namespace_init_session (char *path) |
238 | { | 237 | { |
239 | mu_list_create (&namespace[NS_PRIVATE]); | 238 | mu_list_create (&namespace[NS_PRIVATE]); |
240 | mu_list_append (namespace[NS_PRIVATE], | 239 | mu_list_append (namespace[NS_PRIVATE], |
241 | mu_strdup (mu_normalize_path (path, "/"))); | 240 | mu_strdup (mu_normalize_path (path))); |
242 | return 0; | 241 | return 0; |
243 | } | 242 | } |
244 | 243 | ||
... | @@ -248,7 +247,7 @@ normalize_fun (void *item, void *data) | ... | @@ -248,7 +247,7 @@ normalize_fun (void *item, void *data) |
248 | char *name = item; | 247 | char *name = item; |
249 | mu_list_t list = data; | 248 | mu_list_t list = data; |
250 | return mu_list_append (list, | 249 | return mu_list_append (list, |
251 | mu_strdup (mu_normalize_path (name, "/"))); | 250 | mu_strdup (mu_normalize_path (name))); |
252 | } | 251 | } |
253 | 252 | ||
254 | static void | 253 | static void | ... | ... |
... | @@ -47,7 +47,7 @@ util_getfullpath (char *name, const char *delim) | ... | @@ -47,7 +47,7 @@ util_getfullpath (char *name, const char *delim) |
47 | free (p); | 47 | free (p); |
48 | p = s; | 48 | p = s; |
49 | } | 49 | } |
50 | return mu_normalize_path (p, delim); | 50 | return mu_normalize_path (p); |
51 | } | 51 | } |
52 | 52 | ||
53 | static int | 53 | static int | ... | ... |
... | @@ -96,7 +96,7 @@ extern int mu_get_user_email_domain (const char** domain); | ... | @@ -96,7 +96,7 @@ extern int mu_get_user_email_domain (const char** domain); |
96 | */ | 96 | */ |
97 | extern char *mu_get_user_email (const char *name); | 97 | extern char *mu_get_user_email (const char *name); |
98 | 98 | ||
99 | extern char *mu_normalize_path (char *path, const char *delim); | 99 | extern char *mu_normalize_path (char *path); |
100 | extern int mu_tempfile (const char *tmpdir, char **namep); | 100 | extern int mu_tempfile (const char *tmpdir, char **namep); |
101 | extern char *mu_tempname (const char *tmpdir); | 101 | extern char *mu_tempname (const char *tmpdir); |
102 | 102 | ... | ... |
... | @@ -495,10 +495,9 @@ mu_get_user_email (const char *name) | ... | @@ -495,10 +495,9 @@ mu_get_user_email (const char *name) |
495 | /home/user/../smith --> /home/smith | 495 | /home/user/../smith --> /home/smith |
496 | /home/user/../.. --> / | 496 | /home/user/../.. --> / |
497 | 497 | ||
498 | FIXME: delim is superfluous. The function deals with unix filesystem | 498 | */ |
499 | paths, so delim should be always "/" */ | ||
500 | char * | 499 | char * |
501 | mu_normalize_path (char *path, const char *delim) | 500 | mu_normalize_path (char *path) |
502 | { | 501 | { |
503 | int len; | 502 | int len; |
504 | char *p; | 503 | char *p; |
... | @@ -513,21 +512,21 @@ mu_normalize_path (char *path, const char *delim) | ... | @@ -513,21 +512,21 @@ mu_normalize_path (char *path, const char *delim) |
513 | return path; | 512 | return path; |
514 | 513 | ||
515 | /* delete trailing delimiter if any */ | 514 | /* delete trailing delimiter if any */ |
516 | if (len && path[len-1] == delim[0]) | 515 | if (len && path[len-1] == '/') |
517 | path[len-1] = 0; | 516 | path[len-1] = 0; |
518 | 517 | ||
519 | /* Eliminate any /../ */ | 518 | /* Eliminate any /../ */ |
520 | for (p = strchr (path, '.'); p; p = strchr (p, '.')) | 519 | for (p = strchr (path, '.'); p; p = strchr (p, '.')) |
521 | { | 520 | { |
522 | if (p > path && p[-1] == delim[0]) | 521 | if (p > path && p[-1] == '/') |
523 | { | 522 | { |
524 | if (p[1] == '.' && (p[2] == 0 || p[2] == delim[0])) | 523 | if (p[1] == '.' && (p[2] == 0 || p[2] == '/')) |
525 | /* found */ | 524 | /* found */ |
526 | { | 525 | { |
527 | char *q, *s; | 526 | char *q, *s; |
528 | 527 | ||
529 | /* Find previous delimiter */ | 528 | /* Find previous delimiter */ |
530 | for (q = p-2; *q != delim[0] && q >= path; q--) | 529 | for (q = p-2; *q != '/' && q >= path; q--) |
531 | ; | 530 | ; |
532 | 531 | ||
533 | if (q < path) | 532 | if (q < path) |
... | @@ -546,7 +545,7 @@ mu_normalize_path (char *path, const char *delim) | ... | @@ -546,7 +545,7 @@ mu_normalize_path (char *path, const char *delim) |
546 | 545 | ||
547 | if (path[0] == 0) | 546 | if (path[0] == 0) |
548 | { | 547 | { |
549 | path[0] = delim[0]; | 548 | path[0] = '/'; |
550 | path[1] = 0; | 549 | path[1] = 0; |
551 | } | 550 | } |
552 | 551 | ... | ... |
-
Please register or sign in to post a comment