]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - x11fwd.c
Update docs/usage for 'plink -shareexists'.
[PuTTY.git] / x11fwd.c
index 7ecb4cc27b42cc5c74ef928df3dee64fe69387fd..6cfec72824304b8e853802b599c12ed932802a91 100644 (file)
--- a/x11fwd.c
+++ b/x11fwd.c
@@ -190,7 +190,7 @@ int x11_authcmp(void *av, void *bv)
     }
 }
 
-struct X11Display *x11_setup_display(char *display, Conf *conf)
+struct X11Display *x11_setup_display(const char *display, Conf *conf)
 {
     struct X11Display *disp = snew(struct X11Display);
     char *localcopy;
@@ -357,10 +357,10 @@ void x11_free_display(struct X11Display *disp)
 
 #define XDM_MAXSKEW 20*60      /* 20 minute clock skew should be OK */
 
-static char *x11_verify(unsigned long peer_ip, int peer_port,
-                       tree234 *authtree, char *proto,
-                       unsigned char *data, int dlen,
-                        struct X11FakeAuth **auth_ret)
+static const char *x11_verify(unsigned long peer_ip, int peer_port,
+                              tree234 *authtree, char *proto,
+                              unsigned char *data, int dlen,
+                              struct X11FakeAuth **auth_ret)
 {
     struct X11FakeAuth match_dummy;    /* for passing to find234 */
     struct X11FakeAuth *auth;
@@ -420,7 +420,8 @@ static char *x11_verify(unsigned long peer_ip, int peer_port,
            if (data[i] != 0)          /* zero padding wrong */
                return "XDM-AUTHORIZATION-1 data failed check";
        tim = time(NULL);
-       if (abs(t - tim) > XDM_MAXSKEW)
+       if (((unsigned long)t - (unsigned long)tim
+             + XDM_MAXSKEW) > 2*XDM_MAXSKEW)
            return "XDM-AUTHORIZATION-1 time stamp was too far out";
        seen = snew(struct XDMSeen);
        seen->time = t;