]> git.pld-linux.org Git - packages/gdm2.20.git/blob - gdm-xdmcp.patch
- some patches from helixcode
[packages/gdm2.20.git] / gdm-xdmcp.patch
1 diff -Nur gdm-2.0beta4/daemon/xdmcp.c gdm-2.0beta4.new/daemon/xdmcp.c
2 --- gdm-2.0beta4/daemon/xdmcp.c Thu Sep 30 00:56:35 1999
3 +++ gdm-2.0beta4.new/daemon/xdmcp.c     Thu Dec 21 21:51:44 2000
4 @@ -149,7 +149,7 @@
5  int gdm_xdmcp_init (void);
6  void gdm_xdmcp_run (void);
7  void gdm_xdmcp_close (void);
8 -static void gdm_xdmcp_decode_packet (void);
9 +static gboolean gdm_xdmcp_decode_packet (void);
10  static void gdm_xdmcp_handle_query  (struct sockaddr_in *clnt_sa, gint len, gint type);
11  static void gdm_xdmcp_send_forward_query (GdmIndirectDisplay *id, ARRAYofARRAY8Ptr authlist);
12  static void gdm_xdmcp_handle_forward_query (struct sockaddr_in *clnt_sa, gint len);
13 @@ -267,7 +267,7 @@
14  }
15  
16  
17 -static void
18 +static gboolean
19  gdm_xdmcp_decode_packet (void)
20  {
21      struct sockaddr_in clnt_sa;
22 @@ -282,17 +282,17 @@
23      
24      if (!XdmcpFill (xdmcpfd, &buf, &clnt_sa, &sa_len)) {
25         gdm_error (_("gdm_xdmcp_decode: Could not create XDMCP buffer!"));
26 -       return;
27 +       return TRUE;
28      }
29      
30      if (!XdmcpReadHeader (&buf, &header)) {
31         gdm_error (_("gdm_xdmcp_decode: Could not read XDMCP header!"));
32 -       return;
33 +       return TRUE;
34      }
35      
36      if (header.version != XDM_PROTOCOL_VERSION) {
37         gdm_error (_("gdm_xdmcp_decode: Incorrect XDMCP version!"));
38 -       return;
39 +       return TRUE;
40      }
41  
42      gdm_debug ("gdm_xdmcp_decode: Received opcode %s from client %s", 
43 @@ -335,6 +335,8 @@
44                    inet_ntoa (clnt_sa.sin_addr));
45         break;
46      }
47 +
48 +    return TRUE;
49  }
50  
51  
52 @@ -437,12 +439,15 @@
53      
54      /* Read display port */
55      if (! XdmcpReadARRAY8 (&buf, &clnt_port)) {
56 +       XdmcpDisposeARRAYofARRAY8 (&clnt_addr);
57         gdm_error (_("gdm_xdmcp_handle_forward_query: Could not read display port number"));
58         return;
59      }
60      
61      /* Extract array of authentication names from Xdmcp packet */
62      if (! XdmcpReadARRAYofARRAY8 (&buf, &clnt_authlist)) {
63 +       XdmcpDisposeARRAYofARRAY8 (&clnt_addr);
64 +       XdmcpDisposeARRAYofARRAY8 (&clnt_port);
65         gdm_error (_("gdm_xdmcp_handle_forward_query: Could not extract authlist from packet")); 
66         return;
67      }
68 @@ -459,7 +464,7 @@
69      
70      if (len != explen) {
71         gdm_error (_("gdm_xdmcp_handle_forward_query: Error in checksum")); 
72 -       return;
73 +       goto out;
74      }
75      
76      /* Find client port number */
77 @@ -467,7 +472,7 @@
78         port = port*256+clnt_port.data[i];
79      
80      /* Find client address. Ugly, ugly. Endianness sucks... */
81 -    memmove (&ia.s_addr, clnt_addr.data, clnt_addr.length);
82 +    memmove (&ia.s_addr, clnt_addr.data, MIN(clnt_addr.length, sizeof(ia.s_addr)));
83      
84      gdm_debug ("gdm_xdmcp_handle_forward_query: Got FORWARD_QUERY from display: %s, port %d", 
85                inet_ntoa (ia), port);
86 @@ -478,14 +483,18 @@
87      disp_sa->sin_port = htons (port);
88      disp_sa->sin_addr.s_addr = ia.s_addr;
89      
90 -    /* Cleanup */
91 -    XdmcpDisposeARRAYofARRAY8 (&clnt_authlist);
92 -    
93      /* Check with tcp_wrappers if display is allowed to access */
94      if (gdm_xdmcp_host_allow (disp_sa)) 
95         gdm_xdmcp_send_willing (disp_sa);
96      else
97         gdm_xdmcp_send_unwilling (disp_sa, FORWARD_QUERY);
98 +
99 +  out:
100 +    g_free(disp_sa);
101 +    /* Cleanup */
102 +    XdmcpDisposeARRAYofARRAY8 (&clnt_authlist);
103 +    XdmcpDisposeARRAYofARRAY8 (&clnt_port);
104 +    XdmcpDisposeARRAYofARRAY8 (&clnt_addr);
105  }
106  
107  
108 @@ -512,7 +521,6 @@
109      XdmcpFlush (xdmcpfd, &buf, clnt_sa, sizeof (struct sockaddr_in));
110  }
111  
112 -
113  static void
114  gdm_xdmcp_send_unwilling (struct sockaddr_in *clnt_sa, gint type)
115  {
116 @@ -540,13 +548,13 @@
117  static void
118  gdm_xdmcp_handle_request (struct sockaddr_in *clnt_sa, gint len)
119  {
120 -    static CARD16 clnt_dspnum;
121 -    static ARRAY16 clnt_conntyp;
122 -    static ARRAYofARRAY8 clnt_addr;
123 -    static ARRAY8 clnt_authname;
124 -    static ARRAY8 clnt_authdata;
125 -    static ARRAYofARRAY8 clnt_authorization;
126 -    static ARRAY8 clnt_manufacturer;
127 +    CARD16 clnt_dspnum;
128 +    ARRAY16 clnt_conntyp;
129 +    ARRAYofARRAY8 clnt_addr;
130 +    ARRAY8 clnt_authname;
131 +    ARRAY8 clnt_authdata;
132 +    ARRAYofARRAY8 clnt_authorization;
133 +    ARRAY8 clnt_manufacturer;
134      gint explen;
135      gint i;
136      gboolean mitauth = FALSE;
137 @@ -637,6 +645,13 @@
138         gdm_xdmcp_send_accept (clnt_sa, clnt_dspnum);
139      else
140         gdm_xdmcp_send_decline (clnt_sa);       
141 +
142 +    XdmcpDisposeARRAY8 (&clnt_authname);
143 +    XdmcpDisposeARRAY8 (&clnt_authdata);
144 +    XdmcpDisposeARRAY8 (&clnt_manufacturer);
145 +    XdmcpDisposeARRAYofARRAY8 (&clnt_addr);
146 +    XdmcpDisposeARRAYofARRAY8 (&clnt_authorization);
147 +    XdmcpDisposeARRAY16 (&clnt_conntyp);
148  }
149  
150  
151 @@ -797,6 +812,8 @@
152         gdm_debug ("gdm_xdmcp_handle_manage: Failed to look up session id %d", clnt_sessid);
153         gdm_xdmcp_send_refuse (clnt_sa, clnt_sessid);
154      }
155 +
156 +    XdmcpDisposeARRAY8(&clnt_dspclass);
157  }
158  
159  
This page took 0.042312 seconds and 4 git commands to generate.