From 5dd103a89c5b260320b322e17d125e1cf620c5bd Mon Sep 17 00:00:00 2001 From: jacob Date: Tue, 21 Sep 2004 16:49:51 +0000 Subject: [PATCH] `ampersat-in-username': tweak `strchr' to `strrchr' where necessary to consistently support usernames containing `@'. git-svn-id: svn://svn.tartarus.org/sgt/putty@4563 cda61777-01e9-0310-a592-d414129be87e --- plink.c | 2 +- psftp.c | 2 +- scp.c | 2 +- unix/uxplink.c | 2 +- window.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plink.c b/plink.c index 307d7298..f6e2a702 100644 --- a/plink.c +++ b/plink.c @@ -484,7 +484,7 @@ int main(int argc, char **argv) /* See if host is of the form user@host */ if (cfg.host[0] != '\0') { - char *atsign = strchr(cfg.host, '@'); + char *atsign = strrchr(cfg.host, '@'); /* Make sure we're not overflowing the user field */ if (atsign) { if (atsign - cfg.host < sizeof cfg.username) { diff --git a/psftp.c b/psftp.c index e5374c5f..ba038b07 100644 --- a/psftp.c +++ b/psftp.c @@ -1870,7 +1870,7 @@ static int psftp_connect(char *userhost, char *user, int portnumber) /* See if host is of the form user@host */ if (cfg.host[0] != '\0') { - char *atsign = strchr(cfg.host, '@'); + char *atsign = strrchr(cfg.host, '@'); /* Make sure we're not overflowing the user field */ if (atsign) { if (atsign - cfg.host < sizeof cfg.username) { diff --git a/scp.c b/scp.c index fe341be1..1c601e97 100644 --- a/scp.c +++ b/scp.c @@ -370,7 +370,7 @@ static void do_cmd(char *host, char *user, char *cmd) /* See if host is of the form user@host */ if (cfg.host[0] != '\0') { - char *atsign = strchr(cfg.host, '@'); + char *atsign = strrchr(cfg.host, '@'); /* Make sure we're not overflowing the user field */ if (atsign) { if (atsign - cfg.host < sizeof cfg.username) { diff --git a/unix/uxplink.c b/unix/uxplink.c index ee446ece..d144cb9f 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -471,7 +471,7 @@ int main(int argc, char **argv) /* See if host is of the form user@host */ if (cfg.host[0] != '\0') { - char *atsign = strchr(cfg.host, '@'); + char *atsign = strrchr(cfg.host, '@'); /* Make sure we're not overflowing the user field */ if (atsign) { if (atsign - cfg.host < sizeof cfg.username) { diff --git a/window.c b/window.c index 762df68a..39ac38dc 100644 --- a/window.c +++ b/window.c @@ -525,7 +525,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) /* See if host is of the form user@host */ if (cfg.host[0] != '\0') { - char *atsign = strchr(cfg.host, '@'); + char *atsign = strrchr(cfg.host, '@'); /* Make sure we're not overflowing the user field */ if (atsign) { if (atsign - cfg.host < sizeof cfg.username) { -- 2.11.0