equal
deleted
inserted
replaced
18 * |
18 * |
19 * CDDL HEADER END |
19 * CDDL HEADER END |
20 */ |
20 */ |
21 |
21 |
22 /* |
22 /* |
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
24 * Use is subject to license terms. |
|
25 */ |
24 */ |
26 |
25 |
27 /* |
26 /* |
28 * The core of ilbd daemon is a single-threaded event loop using |
27 * The core of ilbd daemon is a single-threaded event loop using |
29 * event completion framework; it receives requests from client using |
28 * event completion framework; it receives requests from client using |
115 /* |
114 /* |
116 * NOTE: The following needs to be kept up to date. |
115 * NOTE: The following needs to be kept up to date. |
117 */ |
116 */ |
118 #define ILBD_VERSION "1.0" |
117 #define ILBD_VERSION "1.0" |
119 #define ILBD_COPYRIGHT \ |
118 #define ILBD_COPYRIGHT \ |
120 "Copyright 2009 Sun Microsystems, Inc. All rights reserved.\n" \ |
119 "Copyright (c) 2005, 2010, Oracle and/or its affiliates. " \ |
121 "Use is subject to license terms.\n" |
120 "All rights reserved.\n" |
122 |
121 |
123 /* |
122 /* |
124 * Global reply buffer to client request. Note that ilbd is single threaded, |
123 * Global reply buffer to client request. Note that ilbd is single threaded, |
125 * so a global buffer is OK. If ilbd becomes multi-threaded, this needs to |
124 * so a global buffer is OK. If ilbd becomes multi-threaded, this needs to |
126 * be changed. |
125 * be changed. |
620 goto clean_up; |
619 goto clean_up; |
621 } |
620 } |
622 res = getpeerucred(new_sd, &cli->cli_peer_ucredp); |
621 res = getpeerucred(new_sd, &cli->cli_peer_ucredp); |
623 if (res == -1) { |
622 if (res == -1) { |
624 logperror("new_req: getpeerucred failed"); |
623 logperror("new_req: getpeerucred failed"); |
|
624 free(cli); |
625 goto clean_up; |
625 goto clean_up; |
626 } |
626 } |
627 if ((uid = ucred_getruid(cli->cli_peer_ucredp)) == (uid_t)-1) { |
627 if ((uid = ucred_getruid(cli->cli_peer_ucredp)) == (uid_t)-1) { |
628 logperror("new_req: ucred_getruid failed"); |
628 logperror("new_req: ucred_getruid failed"); |
|
629 free(cli); |
629 goto clean_up; |
630 goto clean_up; |
630 } |
631 } |
631 cli->cli_pw_bufsz = (size_t)sysconf(_SC_GETPW_R_SIZE_MAX); |
632 cli->cli_pw_bufsz = (size_t)sysconf(_SC_GETPW_R_SIZE_MAX); |
632 if ((cli->cli_pw_buf = malloc(cli->cli_pw_bufsz)) == NULL) { |
633 if ((cli->cli_pw_buf = malloc(cli->cli_pw_bufsz)) == NULL) { |
633 free(cli); |
634 free(cli); |