`ampersat-in-username': tweak `strchr' to `strrchr' where necessary to
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Tue, 21 Sep 2004 16:49:51 +0000 (16:49 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Tue, 21 Sep 2004 16:49:51 +0000 (16:49 +0000)
consistently support usernames containing `@'.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4563 cda61777-01e9-0310-a592-d414129be87e

plink.c
psftp.c
scp.c
unix/uxplink.c
window.c

diff --git a/plink.c b/plink.c
index 307d729..f6e2a70 100644 (file)
--- 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 e5374c5..ba038b0 100644 (file)
--- 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 fe341be..1c601e9 100644 (file)
--- 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) {
index ee446ec..d144cb9 100644 (file)
@@ -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) {
index 762df68..39ac38d 100644 (file)
--- 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) {