While looking at the previous patch I saw that we were still using the sss_nss_ prefix for a number of functions that are used by both the pam and nss responders. Changed the prefix to sss_cli_ so it is more clear those functions are not nss specific.
Simo. -- Simo Sorce * Red Hat, Inc * New York
>From c2ef22d780ae67bb69deeb2080f7c00cd0a1ceaf Mon Sep 17 00:00:00 2001 From: Simo Sorce <sso...@redhat.com> Date: Mon, 7 Feb 2011 10:07:24 -0500 Subject: [PATCH] Use neutral name for functions used by both pam and nss --- src/sss_client/common.c | 40 +++++++++++++++++++--------------------- 1 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/sss_client/common.c b/src/sss_client/common.c index d4b230889396df73c82394369d03cc0a6c979ddc..f2d8d052b8efdb120b706648cdae028c02cf1540 100644 --- a/src/sss_client/common.c +++ b/src/sss_client/common.c @@ -71,7 +71,7 @@ static void sss_cli_close_socket(void) * byte 12-15: 32bit unsigned (reserved) * byte 16-X: (optional) request structure associated to the command code used */ -static enum nss_status sss_nss_send_req(enum sss_cli_command cmd, +static enum nss_status sss_cli_send_req(enum sss_cli_command cmd, struct sss_cli_req_data *rd, int *errnop) { @@ -171,7 +171,7 @@ static enum nss_status sss_nss_send_req(enum sss_cli_command cmd, * byte 16-X: (optional) reply structure associated to the command code used */ -static enum nss_status sss_nss_recv_rep(enum sss_cli_command cmd, +static enum nss_status sss_cli_recv_rep(enum sss_cli_command cmd, uint8_t **_buf, int *_len, int *errnop) { @@ -317,7 +317,7 @@ failed: /* this function will check command codes match and returned length is ok */ /* repbuf and replen report only the data section not the header */ -static enum nss_status sss_nss_make_request_nochecks( +static enum nss_status sss_cli_make_request_nochecks( enum sss_cli_command cmd, struct sss_cli_req_data *rd, uint8_t **repbuf, size_t *replen, @@ -328,13 +328,13 @@ static enum nss_status sss_nss_make_request_nochecks( int len = 0; /* send data */ - ret = sss_nss_send_req(cmd, rd, errnop); + ret = sss_cli_send_req(cmd, rd, errnop); if (ret != NSS_STATUS_SUCCESS) { return ret; } /* data sent, now get reply */ - ret = sss_nss_recv_rep(cmd, &buf, &len, errnop); + ret = sss_cli_recv_rep(cmd, &buf, &len, errnop); if (ret != NSS_STATUS_SUCCESS) { return ret; } @@ -360,14 +360,14 @@ static enum nss_status sss_nss_make_request_nochecks( * 0-3: 32bit unsigned version number */ -static int sss_nss_check_version(const char *socket_name) +static bool sss_cli_check_version(const char *socket_name) { uint8_t *repbuf; size_t replen; enum nss_status nret; int errnop; - int res = NSS_STATUS_UNAVAIL; uint32_t expected_version; + uint32_t obtained_version; struct sss_cli_req_data req; if (strcmp(socket_name, SSS_NSS_SOCKET_NAME) == 0) { @@ -376,28 +376,26 @@ static int sss_nss_check_version(const char *socket_name) strcmp(socket_name, SSS_PAM_PRIV_SOCKET_NAME) == 0) { expected_version = SSS_PAM_PROTOCOL_VERSION; } else { - return NSS_STATUS_UNAVAIL; + return false; } req.len = sizeof(expected_version); req.data = &expected_version; - nret = sss_nss_make_request_nochecks(SSS_GET_VERSION, &req, + nret = sss_cli_make_request_nochecks(SSS_GET_VERSION, &req, &repbuf, &replen, &errnop); if (nret != NSS_STATUS_SUCCESS) { - return nret; + return false; } if (!repbuf) { - return res; - } - - if (((uint32_t *)repbuf)[0] == expected_version) { - res = NSS_STATUS_SUCCESS; + return false; } + obtained_version = ((uint32_t *)repbuf)[0]; free(repbuf); - return res; + + return (obtained_version == expected_version); } /* this 2 functions are adapted from samba3 winbinbd's wb_common.c */ @@ -494,7 +492,7 @@ static int make_safe_fd(int fd) return new_fd; } -static int sss_nss_open_socket(int *errnop, const char *socket_name) +static int sss_cli_open_socket(int *errnop, const char *socket_name) { struct sockaddr_un nssaddr; bool inprogress = true; @@ -663,14 +661,14 @@ static enum sss_status sss_cli_check_socket(int *errnop, const char *socket_name sss_cli_close_socket(); } - mysd = sss_nss_open_socket(errnop, socket_name); + mysd = sss_cli_open_socket(errnop, socket_name); if (mysd == -1) { return SSS_STATUS_UNAVAIL; } sss_cli_sd = mysd; - if (sss_nss_check_version(socket_name) == NSS_STATUS_SUCCESS) { + if (sss_cli_check_version(socket_name)) { return SSS_STATUS_SUCCESS; } @@ -700,7 +698,7 @@ enum nss_status sss_nss_make_request(enum sss_cli_command cmd, return NSS_STATUS_UNAVAIL; } - return sss_nss_make_request_nochecks(cmd, rd, repbuf, replen, errnop); + return sss_cli_make_request_nochecks(cmd, rd, repbuf, replen, errnop); } errno_t check_server_cred(int sockfd) @@ -791,7 +789,7 @@ int sss_pam_make_request(enum sss_cli_command cmd, goto out; } - ret = sss_nss_make_request_nochecks(cmd, rd, repbuf, replen, errnop); + ret = sss_cli_make_request_nochecks(cmd, rd, repbuf, replen, errnop); out: sss_pam_unlock(); -- 1.7.4
_______________________________________________ sssd-devel mailing list sssd-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/sssd-devel