Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 67932 | Differences between
and this patch

Collapse All | Expand All

(-)ldapdns-2.04.original/engine.c (-11 / +22 lines)
Lines 171-177 Link Here
171
#endif
171
#endif
172
172
173
	x = strchr(hostnamestr, ':');
173
	x = strchr(hostnamestr, ':');
174
	if (!x) {
174
	if (!x || (*(x+1) && *(x+1) == '/')) {
175
		port = LDAP_PORT;
175
		port = LDAP_PORT;
176
	} else {
176
	} else {
177
		port = atoi(x+1);
177
		port = atoi(x+1);
Lines 180-187 Link Here
180
180
181
	o->message_sent = 0;
181
	o->message_sent = 0;
182
	o->message_wait = 0; // XXX
182
	o->message_wait = 0; // XXX
183
	o->ldap_con = ldap_init(hostnamestr, port);
183
	if (ldap_is_ldap_url(hostnamestr)) {
184
	if (x) *x = ':'; /* egad */
184
		ldap_initialize(&(o->ldap_con), hostnamestr);
185
	} else {
186
		o->ldap_con = ldap_init(hostnamestr, port);
187
		if (x) *x = ':'; /* egad */
188
	}
185
189
186
	if (!o->ldap_con)
190
	if (!o->ldap_con)
187
		return -1;
191
		return -1;
Lines 3655-3660 Link Here
3655
	str_init(retbuf);
3659
	str_init(retbuf);
3656
	str_copy(retbuf, x);
3660
	str_copy(retbuf, x);
3657
	for (h = str(retbuf); h && *h;) { /* on init: np if it infinites */
3661
	for (h = str(retbuf); h && *h;) { /* on init: np if it infinites */
3662
		int uri=0;
3658
		for (x = h; *x && *x != ',' && *x != ' '
3663
		for (x = h; *x && *x != ',' && *x != ' '
3659
				&& *x != ';' && *x != '\t'; x++);
3664
				&& *x != ';' && *x != '\t'; x++);
3660
		if (*x) {
3665
		if (*x) {
Lines 3666-3683 Link Here
3666
		p = LDAP_PORT;
3671
		p = LDAP_PORT;
3667
		for (y = h; *y && *y != ':'; y++);
3672
		for (y = h; *y && *y != ':'; y++);
3668
		if (*y && *y == ':') {
3673
		if (*y && *y == ':') {
3669
			*y = 0;
3674
			if (*(y+1) && *(y+1) == '/') { /* detect ldap:// uri */
3670
			y++;
3675
				uri=1;
3671
			p = atoi(y);
3676
			} else {
3672
			if (p == -1)
3677
				*y = 0;
3673
				p = LDAP_PORT;
3678
				y++;
3679
				p = atoi(y);
3680
				if (p == -1)
3681
					p = LDAP_PORT;
3682
			}
3674
		}
3683
		}
3675
3684
3676
		str_init(hbuf);
3685
		str_init(hbuf);
3677
		str_copy(hbuf, h);
3686
		str_copy(hbuf, h);
3678
		str_addch(hbuf, ':');
3687
		if (!uri) {
3679
		sprintf(spbuf, "%d", p);
3688
			str_addch(hbuf, ':');
3680
		str_cat(hbuf, spbuf);
3689
			sprintf(spbuf, "%d", p);
3690
			str_cat(hbuf, spbuf);
3691
		}
3681
3692
3682
		list_push(&ldapdns.hosts, str(hbuf));
3693
		list_push(&ldapdns.hosts, str(hbuf));
3683
		h = x;
3694
		h = x;

Return to bug 67932