Diff

Differences From Artifact [63d6340166]:

To Artifact [e6b822ef3d]:


64
65
66
67
68
69
70
71

72
73
74
75
76
77
78
79
64
65
66
67
68
69
70

71

72
73
74
75
76
77
78







-
+
-







static void dummy_plug_sent(Plug p, int bufsize) { }
static int dummy_plug_accepting(Plug p, OSSocket sock) { return 1; }
static const struct plug_function_table dummy_plug = {
    dummy_plug_log, dummy_plug_closing, dummy_plug_receive,
    dummy_plug_sent, dummy_plug_accepting
};

struct X11Display *x11_setup_display(char *display, int authtype,
struct X11Display *x11_setup_display(char *display, int authtype, Conf *conf)
				     const Config *cfg)
{
    struct X11Display *disp = snew(struct X11Display);
    char *localcopy;
    int i;

    if (!display || !*display) {
	localcopy = platform_get_x_display();
162
163
164
165
166
167
168
169

170
171
172
173
174
175
176
161
162
163
164
165
166
167

168
169
170
171
172
173
174
175







-
+







     * Look up the display hostname, if we need to.
     */
    if (!disp->unixdomain) {
	const char *err;

	disp->port = 6000 + disp->displaynum;
	disp->addr = name_lookup(disp->hostname, disp->port,
				 &disp->realhost, cfg, ADDRTYPE_UNSPEC);
				 &disp->realhost, conf, ADDRTYPE_UNSPEC);
    
	if ((err = sk_addr_error(disp->addr)) != NULL) {
	    sk_addr_free(disp->addr);
	    sfree(disp->hostname);
	    sfree(disp->unixsocketpath);
	    return NULL;	       /* FIXME: report an error */
	}
245
246
247
248
249
250
251
252

253
254
255
256
257
258
259
244
245
246
247
248
249
250

251
252
253
254
255
256
257
258







-
+








    /*
     * Fetch the local authorisation details.
     */
    disp->localauthproto = X11_NO_AUTH;
    disp->localauthdata = NULL;
    disp->localauthdatalen = 0;
    platform_get_x11_auth(disp, cfg);
    platform_get_x11_auth(disp, conf);

    return disp;
}

void x11_free_display(struct X11Display *disp)
{
    if (disp->xdmseen != NULL) {
554
555
556
557
558
559
560
561

562
563
564
565
566
567
568
569
553
554
555
556
557
558
559

560

561
562
563
564
565
566
567







-
+
-







/*
 * Called to set up the raw connection.
 * 
 * Returns an error message, or NULL on success.
 * also, fills the SocketsStructure
 */
extern const char *x11_init(Socket *s, struct X11Display *disp, void *c,
			    const char *peeraddr, int peerport,
			    const char *peeraddr, int peerport, Conf *conf)
			    const Config *cfg)
{
    static const struct plug_function_table fn_table = {
	x11_log,
	x11_closing,
	x11_receive,
	x11_sent,
	NULL
582
583
584
585
586
587
588
589

590
591
592
593
594
595
596
580
581
582
583
584
585
586

587
588
589
590
591
592
593
594







-
+







    pr->verified = 0;
    pr->data_read = 0;
    pr->throttled = pr->throttle_override = 0;
    pr->c = c;

    pr->s = *s = new_connection(sk_addr_dup(disp->addr),
				disp->realhost, disp->port,
				0, 1, 0, 0, (Plug) pr, cfg);
				0, 1, 0, 0, (Plug) pr, conf);
    if ((err = sk_socket_error(*s)) != NULL) {
	sfree(pr);
	return err;
    }

    /*
     * See if we can make sense of the peer address we were given.