nsswitch/winbind_client.h

ソースコードを見る。

関数

void init_request (struct winbindd_request *req, int rq_type)
NSS_STATUS winbindd_send_request (int req_type, int need_priv, struct winbindd_request *request)
NSS_STATUS winbindd_get_response (struct winbindd_response *response)
NSS_STATUS winbindd_request_response (int req_type, struct winbindd_request *request, struct winbindd_response *response)
NSS_STATUS winbindd_priv_request_response (int req_type, struct winbindd_request *request, struct winbindd_response *response)
int write_sock (void *buffer, int count, int recursing, int need_priv)
int read_reply (struct winbindd_response *response)
void close_sock (void)
void free_response (struct winbindd_response *response)


関数

void init_request ( struct winbindd_request req,
int  rq_type 
)

wb_common.c50 行で定義されています。

参照先 winbindd_request::cmdwinbindd_request::lengthwinbindd_request::pid.

参照元 pam_winbind_request()winbindd_send_request().

00051 {
00052         request->length = sizeof(struct winbindd_request);
00053 
00054         request->cmd = (enum winbindd_cmd)request_type;
00055         request->pid = getpid();
00056 
00057 }

NSS_STATUS winbindd_send_request ( int  req_type,
int  need_priv,
struct winbindd_request request 
)

wb_common.c556 行で定義されています。

参照先 errnowinbindd_request::flagsinit_request()NSS_STATUS_NOTFOUNDNSS_STATUS_SUCCESSNSS_STATUS_UNAVAILwinbind_env_set()write_sock().

参照元 send_next_request()winbindd_priv_request_response()winbindd_request_response().

00558 {
00559         struct winbindd_request lrequest;
00560 
00561         /* Check for our tricky environment variable */
00562 
00563         if (winbind_env_set()) {
00564                 return NSS_STATUS_NOTFOUND;
00565         }
00566 
00567         if (!request) {
00568                 ZERO_STRUCT(lrequest);
00569                 request = &lrequest;
00570         }
00571         
00572         /* Fill in request and send down pipe */
00573 
00574         init_request(request, req_type);
00575         
00576         if (write_sock(request, sizeof(*request),
00577                        request->flags & WBFLAG_RECURSE, need_priv) == -1) {
00578                 /* Set ENOENT for consistency.  Required by some apps */
00579                 errno = ENOENT;
00580                 
00581                 return NSS_STATUS_UNAVAIL;
00582         }
00583 
00584         if ((request->extra_len != 0) &&
00585             (write_sock(request->extra_data.data, request->extra_len,
00586                         request->flags & WBFLAG_RECURSE, need_priv) == -1)) {
00587                 /* Set ENOENT for consistency.  Required by some apps */
00588                 errno = ENOENT;
00589 
00590                 return NSS_STATUS_UNAVAIL;
00591         }
00592         
00593         return NSS_STATUS_SUCCESS;
00594 }

NSS_STATUS winbindd_get_response ( struct winbindd_response response  ) 

wb_common.c600 行で定義されています。

参照先 errnofree_response()init_response()NSS_STATUS_NOTFOUNDNSS_STATUS_SUCCESSNSS_STATUS_UNAVAILread_reply()winbindd_response::resultWINBINDD_OK.

参照元 winbind_callback()winbindd_priv_request_response()winbindd_request_response().

00601 {
00602         struct winbindd_response lresponse;
00603 
00604         if (!response) {
00605                 ZERO_STRUCT(lresponse);
00606                 response = &lresponse;
00607         }
00608 
00609         init_response(response);
00610 
00611         /* Wait for reply */
00612         if (read_reply(response) == -1) {
00613                 /* Set ENOENT for consistency.  Required by some apps */
00614                 errno = ENOENT;
00615 
00616                 return NSS_STATUS_UNAVAIL;
00617         }
00618 
00619         /* Throw away extra data if client didn't request it */
00620         if (response == &lresponse) {
00621                 free_response(response);
00622         }
00623 
00624         /* Copy reply data from socket */
00625         if (response->result != WINBINDD_OK) {
00626                 return NSS_STATUS_NOTFOUND;
00627         }
00628         
00629         return NSS_STATUS_SUCCESS;
00630 }

NSS_STATUS winbindd_request_response ( int  req_type,
struct winbindd_request request,
struct winbindd_response response 
)

wb_common.c634 行で定義されています。

00637 {
00638         NSS_STATUS status = NSS_STATUS_UNAVAIL;
00639         int count = 0;
00640 
00641         while ((status == NSS_STATUS_UNAVAIL) && (count < 10)) {
00642                 status = winbindd_send_request(req_type, 0, request);
00643                 if (status != NSS_STATUS_SUCCESS) 
00644                         return(status);
00645                 status = winbindd_get_response(response);
00646                 count += 1;
00647         }
00648 
00649         return status;
00650 }

NSS_STATUS winbindd_priv_request_response ( int  req_type,
struct winbindd_request request,
struct winbindd_response response 
)

wb_common.c652 行で定義されています。

参照先 NSS_STATUS_SUCCESSNSS_STATUS_UNAVAILstatuswinbindd_get_response()winbindd_send_request().

参照元 check_winbind_security().

00655 {
00656         NSS_STATUS status = NSS_STATUS_UNAVAIL;
00657         int count = 0;
00658 
00659         while ((status == NSS_STATUS_UNAVAIL) && (count < 10)) {
00660                 status = winbindd_send_request(req_type, 1, request);
00661                 if (status != NSS_STATUS_SUCCESS) 
00662                         return(status);
00663                 status = winbindd_get_response(response);
00664                 count += 1;
00665         }
00666 
00667         return status;
00668 }

int write_sock ( void *  buffer,
int  count,
int  recursing,
int  need_priv 
)

wb_common.c361 行で定義されています。

参照先 close_sock()errnoresultwinbind_open_pipe_sock()winbindd_fd.

参照元 pam_winbind_request()winbindd_send_request().

00362 {
00363         int result, nwritten;
00364         
00365         /* Open connection to winbind daemon */
00366         
00367  restart:
00368         
00369         if (winbind_open_pipe_sock(recursing, need_priv) == -1) {
00370                 errno = ENOENT;
00371                 return -1;
00372         }
00373         
00374         /* Write data to socket */
00375         
00376         nwritten = 0;
00377         
00378         while(nwritten < count) {
00379                 struct timeval tv;
00380                 fd_set r_fds;
00381                 
00382                 /* Catch pipe close on other end by checking if a read()
00383                    call would not block by calling select(). */
00384 
00385                 FD_ZERO(&r_fds);
00386                 FD_SET(winbindd_fd, &r_fds);
00387                 ZERO_STRUCT(tv);
00388                 
00389                 if (select(winbindd_fd + 1, &r_fds, NULL, NULL, &tv) == -1) {
00390                         close_sock();
00391                         return -1;                   /* Select error */
00392                 }
00393                 
00394                 /* Write should be OK if fd not available for reading */
00395                 
00396                 if (!FD_ISSET(winbindd_fd, &r_fds)) {
00397                         
00398                         /* Do the write */
00399                         
00400                         result = write(winbindd_fd,
00401                                        (char *)buffer + nwritten, 
00402                                        count - nwritten);
00403                         
00404                         if ((result == -1) || (result == 0)) {
00405                                 
00406                                 /* Write failed */
00407                                 
00408                                 close_sock();
00409                                 return -1;
00410                         }
00411                         
00412                         nwritten += result;
00413                         
00414                 } else {
00415                         
00416                         /* Pipe has closed on remote end */
00417                         
00418                         close_sock();
00419                         goto restart;
00420                 }
00421         }
00422         
00423         return nwritten;
00424 }

int read_reply ( struct winbindd_response response  ) 

wb_common.c494 行で定義されています。

参照先 winbindd_response::datawinbindd_response::extra_datafree_response()winbindd_response::lengthread_sock().

参照元 pam_winbind_request()winbindd_get_response().

00495 {
00496         int result1, result2 = 0;
00497 
00498         if (!response) {
00499                 return -1;
00500         }
00501         
00502         /* Read fixed length response */
00503         
00504         if ((result1 = read_sock(response, sizeof(struct winbindd_response)))
00505             == -1) {
00506                 
00507                 return -1;
00508         }
00509         
00510         /* We actually send the pointer value of the extra_data field from
00511            the server.  This has no meaning in the client's address space
00512            so we clear it out. */
00513 
00514         response->extra_data.data = NULL;
00515 
00516         /* Read variable length response */
00517         
00518         if (response->length > sizeof(struct winbindd_response)) {
00519                 int extra_data_len = response->length - 
00520                         sizeof(struct winbindd_response);
00521                 
00522                 /* Mallocate memory for extra data */
00523                 
00524                 if (!(response->extra_data.data = malloc(extra_data_len))) {
00525                         return -1;
00526                 }
00527                 
00528                 if ((result2 = read_sock(response->extra_data.data, extra_data_len))
00529                     == -1) {
00530                         free_response(response);
00531                         return -1;
00532                 }
00533         }
00534         
00535         /* Return total amount of data read */
00536         
00537         return result1 + result2;
00538 }

void close_sock ( void   ) 

wb_common.c70 行で定義されています。

参照先 winbindd_fd.

参照元 pam_winbind_request()read_sock()winbind_open_pipe_sock()write_sock().

00071 {
00072         if (winbindd_fd != -1) {
00073                 close(winbindd_fd);
00074                 winbindd_fd = -1;
00075         }
00076 }

void free_response ( struct winbindd_response response  ) 

wb_common.c40 行で定義されています。

参照先 winbindd_response::datawinbindd_response::extra_data.

参照元 _nss_winbind_endgrent()_nss_winbind_endpwent()_nss_winbind_getgrgid_r()_nss_winbind_getgrnam_r()_nss_winbind_getpwent_r()_nss_winbind_getpwnam_r()_nss_winbind_getpwuid_r()_nss_winbind_getusersids()_nss_winbind_gidtosid()_nss_winbind_hosts_getbyaddr()_nss_winbind_hosts_getbyname()_nss_winbind_ipnodes_getbyname()_nss_winbind_nametosid()_nss_winbind_setgrent()_nss_winbind_setpwent()_nss_winbind_sidtoname()_nss_winbind_uidtosid()contact_winbind_auth_crap()contact_winbind_change_pswd_auth_crap()do_ccache_ntlm_auth()read_reply()wb_aix_authenticate()wb_aix_chpass()wb_aix_getgrgid()wb_aix_getgrnam()wb_aix_getgrset()wb_aix_getpwnam()wb_aix_getpwuid()wb_aix_lsgroup()wb_aix_lsuser()winbind_callback()winbind_getgrent()winbindd_get_response().

00041 {
00042         /* Free any allocated extra_data */
00043 
00044         if (response)
00045                 SAFE_FREE(response->extra_data.data);
00046 }


Sambaに対してSat Aug 29 21:23:55 2009に生成されました。  doxygen 1.4.7