View | Details | Raw Unified | Return to bug 25751
Collapse All | Expand All

(-)in_pcb.c (-8 / +22 lines)
Lines 272-279 Link Here
272
		int count;
272
		int count;
273
273
274
		if (inp->inp_laddr.s_addr != INADDR_ANY)
274
		if (inp->inp_laddr.s_addr != INADDR_ANY)
275
			if (prison_ip(p->p_ucred, 0, &inp->inp_laddr.s_addr ))
275
			if (prison_ip(p->p_ucred, 0, &inp->inp_laddr.s_addr )) {
276
				/*
277
				 * Undo any address bind that may have
278
				 * occurred above.
279
				 */
280
				inp->inp_laddr.s_addr = INADDR_ANY;
281
276
				return (EINVAL);
282
				return (EINVAL);
283
			}
277
		inp->inp_flags |= INP_ANONPORT;
284
		inp->inp_flags |= INP_ANONPORT;
278
285
279
		if (inp->inp_flags & INP_HIGHPORT) {
286
		if (inp->inp_flags & INP_HIGHPORT) {
Lines 281-288 Link Here
281
			last  = ipport_hilastauto;
288
			last  = ipport_hilastauto;
282
			lastport = &pcbinfo->lasthi;
289
			lastport = &pcbinfo->lasthi;
283
		} else if (inp->inp_flags & INP_LOWPORT) {
290
		} else if (inp->inp_flags & INP_LOWPORT) {
284
			if (p && (error = suser_xxx(0, p, PRISON_ROOT)))
291
			if (p && (error = suser_xxx(0, p, PRISON_ROOT))) {
292
				/*
293
				 * Undo any address bind that may have
294
				 * occurred above.
295
				 */
296
				inp->inp_laddr.s_addr = INADDR_ANY;
285
				return error;
297
				return error;
298
			}
286
			first = ipport_lowfirstauto;	/* 1023 */
299
			first = ipport_lowfirstauto;	/* 1023 */
287
			last  = ipport_lowlastauto;	/* 600 */
300
			last  = ipport_lowlastauto;	/* 600 */
288
			lastport = &pcbinfo->lastlow;
301
			lastport = &pcbinfo->lastlow;
Lines 306-315 Link Here
306
319
307
			do {
320
			do {
308
				if (count-- < 0) {	/* completely used? */
321
				if (count-- < 0) {	/* completely used? */
309
					/*
310
					 * Undo any address bind that may have
311
					 * occurred above.
312
					 */
313
					inp->inp_laddr.s_addr = INADDR_ANY;
322
					inp->inp_laddr.s_addr = INADDR_ANY;
314
					return (EADDRNOTAVAIL);
323
					return (EADDRNOTAVAIL);
315
				}
324
				}
Lines 343-350 Link Here
343
		}
352
		}
344
	}
353
	}
345
	inp->inp_lport = lport;
354
	inp->inp_lport = lport;
346
	if (prison_ip(p->p_ucred, 0, &inp->inp_laddr.s_addr))
355
	
347
		return(EINVAL);
356
	if (prison_ip(p->p_ucred, 0, &inp->inp_laddr.s_addr)) {
357
		inp->inp_laddr.s_addr = INADDR_ANY;
358
		inp->inp_lport = 0;
359
		return (EINVAL);
360
	}
361
	
348
	if (in_pcbinshash(inp) != 0) {
362
	if (in_pcbinshash(inp) != 0) {
349
		inp->inp_laddr.s_addr = INADDR_ANY;
363
		inp->inp_laddr.s_addr = INADDR_ANY;
350
		inp->inp_lport = 0;
364
		inp->inp_lport = 0;

Return to bug 25751