Deleted Added
full compact
sockopt.c (302408) sockopt.c (362181)
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0

--- 316 unchanged lines hidden (view full) ---

325 (void *)&on, sizeof(int)) == -1) {
326 return errno;
327 }
328 apr_set_option(sock, APR_IPV6_V6ONLY, on);
329#else
330 return APR_ENOTIMPL;
331#endif
332 break;
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0

--- 316 unchanged lines hidden (view full) ---

325 (void *)&on, sizeof(int)) == -1) {
326 return errno;
327 }
328 apr_set_option(sock, APR_IPV6_V6ONLY, on);
329#else
330 return APR_ENOTIMPL;
331#endif
332 break;
333 case APR_SO_FREEBIND:
334#if defined(IP_FREEBIND)
335 if (setsockopt(sock->socketdes, SOL_IP, IP_FREEBIND,
336 (void *)&one, sizeof(int)) == -1) {
337 return errno;
338 }
339 apr_set_option(sock, APR_SO_FREEBIND, on);
340#elif 0 /* defined(IP_BINDANY) ... */
341 /* TODO: insert FreeBSD support here, note family specific
342 * options, IP_BINDANY vs IPV6_BINDANY */
343#else
344 return APR_ENOTIMPL;
345#endif
346 break;
333 default:
334 return APR_EINVAL;
335 }
336
337 return APR_SUCCESS;
338}
339
340

--- 82 unchanged lines hidden (view full) ---

423
424 if ((setsockopt(sock->socketdes, SOL_SOCKET, SO_ACCEPTFILTER,
425 &af, sizeof(af))) < 0) {
426 return errno;
427 }
428 return APR_SUCCESS;
429}
430#endif
347 default:
348 return APR_EINVAL;
349 }
350
351 return APR_SUCCESS;
352}
353
354

--- 82 unchanged lines hidden (view full) ---

437
438 if ((setsockopt(sock->socketdes, SOL_SOCKET, SO_ACCEPTFILTER,
439 &af, sizeof(af))) < 0) {
440 return errno;
441 }
442 return APR_SUCCESS;
443}
444#endif
445
446APR_PERMS_SET_IMPLEMENT(socket)
447{
448#if APR_HAVE_SOCKADDR_UN
449 apr_status_t rv = APR_SUCCESS;
450 apr_socket_t *socket = (apr_socket_t *)thesocket;
451
452 if (socket->local_addr->family == APR_UNIX) {
453 if (!(perms & APR_FPROT_GSETID))
454 gid = -1;
455 if (fchown(socket->socketdes, uid, gid) < 0) {
456 rv = errno;
457 }
458 }
459 else
460 rv = APR_EINVAL;
461 return rv;
462#else
463 return APR_ENOTIMPL;
464#endif
465}