[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Jul 24 21:32:02 UTC 2018


The branch, master has been updated
       via  7d40f60 winbind: Move variable declarations close to their use
       via  8a53043 winbind: Align integer types
       via  da179b1 nsswitch: Correct users of "ctx->is_privileged"
       via  d4c6b009 nsswitch: Make two functions static
       via  3c9b88b nsswitch: Remove IRIX support
       via  7daf5e6 lib: Fix prototype of srprs_str
       via  a845e96 lib: Remove an #include "includes.h"
       via  6a91ba4 lib: Remove an #include "includes.h"
      from  10fc65b s3:util_sec: add a cache to set_thread_credentials()

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 7d40f6079926ae93406b0c09ea5111e643b29a00
Author: Volker Lendecke <vl at samba.org>
Date:   Thu May 3 11:48:45 2018 +0200

    winbind: Move variable declarations close to their use
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Jul 24 23:31:43 CEST 2018 on sn-devel-144

commit 8a530433e0499f2c1a14a801e49e5ecf0a13dc74
Author: Volker Lendecke <vl at samba.org>
Date:   Fri May 4 21:07:35 2018 +0200

    winbind: Align integer types
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit da179b1e4c54bec67214546973ced7a16e4caec5
Author: Volker Lendecke <vl at samba.org>
Date:   Fri May 4 15:23:18 2018 +0200

    nsswitch: Correct users of "ctx->is_privileged"
    
    winbindd_context->is_privileged is a bool
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d4c6b009223c1ed6caf538c35b42e16c98e2bded
Author: Volker Lendecke <vl at samba.org>
Date:   Fri May 4 14:40:12 2018 +0200

    nsswitch: Make two functions static
    
    nss_irix was the only external user
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3c9b88ba1c79c6927e5e905afbef225de02eee9d
Author: Volker Lendecke <vl at samba.org>
Date:   Fri May 4 14:33:55 2018 +0200

    nsswitch: Remove IRIX support
    
    According to wikipedia, IRIX has seen the last patch update in August 2006. As
    of now, www.sgi.com is unreachable. Probably this code has not been built in
    years. If someone wants to revive it, it can be found in the git history.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 7daf5e627690350f19482cf0b72b070a09fd4235
Author: Volker Lendecke <vl at samba.org>
Date:   Fri May 4 22:28:43 2018 +0200

    lib: Fix prototype of srprs_str
    
    Many callers use "-1" as the "len" argument. That's what ssize_t is for.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a845e9614742dbde40070ab0f2589505ee0ed2aa
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Apr 25 11:53:00 2018 +0200

    lib: Remove an #include "includes.h"
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 6a91ba4f7eacf2a2043068c3680a3bc47fb5d26c
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Apr 25 11:51:36 2018 +0200

    lib: Remove an #include "includes.h"
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 nsswitch/wb_common.c             |  22 +-
 nsswitch/winbind_client.h        |   5 -
 nsswitch/winbind_nss_irix.c      | 633 ---------------------------------------
 nsswitch/winbind_nss_irix.h      |  42 ---
 nsswitch/wscript_build           |   6 -
 source3/lib/cbuf.c               |  10 +-
 source3/lib/srprs.c              |   6 +-
 source3/lib/srprs.h              |   2 +-
 source3/winbindd/winbindd.c      |   6 +-
 source3/winbindd/winbindd_misc.c |   4 +-
 10 files changed, 30 insertions(+), 706 deletions(-)
 delete mode 100644 nsswitch/winbind_nss_irix.c
 delete mode 100644 nsswitch/winbind_nss_irix.h


Changeset truncated at 500 lines:

diff --git a/nsswitch/wb_common.c b/nsswitch/wb_common.c
index 6768fde..42b341b 100644
--- a/nsswitch/wb_common.c
+++ b/nsswitch/wb_common.c
@@ -37,7 +37,7 @@ struct winbindd_context {
 
 static struct winbindd_context wb_global_ctx = {
 	.winbindd_fd = -1,
-	.is_privileged = 0,
+	.is_privileged = false,
 	.our_pid = 0
 };
 
@@ -371,7 +371,7 @@ static int winbind_open_pipe_sock(struct winbindd_context *ctx,
 		ctx->our_pid = getpid();
 	}
 
-	if ((need_priv != 0) && (ctx->is_privileged == 0)) {
+	if ((need_priv != 0) && !ctx->is_privileged) {
 		winbind_close_sock(ctx);
 	}
 
@@ -389,7 +389,7 @@ static int winbind_open_pipe_sock(struct winbindd_context *ctx,
 		return -1;
 	}
 
-	ctx->is_privileged = 0;
+	ctx->is_privileged = false;
 
 	/* version-check the socket */
 
@@ -422,13 +422,13 @@ static int winbind_open_pipe_sock(struct winbindd_context *ctx,
 		if (fd != -1) {
 			close(ctx->winbindd_fd);
 			ctx->winbindd_fd = fd;
-			ctx->is_privileged = 1;
+			ctx->is_privileged = true;
 		}
 
 		SAFE_FREE(response.extra_data.data);
 	}
 
-	if (ctx->is_privileged == 0) {
+	if (!ctx->is_privileged) {
 		return -1;
 	}
 
@@ -632,9 +632,11 @@ static int winbindd_read_reply(struct winbindd_context *ctx,
  * send simple types of requests
  */
 
-NSS_STATUS winbindd_send_request(struct winbindd_context *ctx,
-				 int req_type, int need_priv,
-				 struct winbindd_request *request)
+static NSS_STATUS winbindd_send_request(
+	struct winbindd_context *ctx,
+	int req_type,
+	int need_priv,
+	struct winbindd_request *request)
 {
 	struct winbindd_request lrequest;
 
@@ -682,8 +684,8 @@ NSS_STATUS winbindd_send_request(struct winbindd_context *ctx,
  * Get results from winbindd request
  */
 
-NSS_STATUS winbindd_get_response(struct winbindd_context *ctx,
-				 struct winbindd_response *response)
+static NSS_STATUS winbindd_get_response(struct winbindd_context *ctx,
+					struct winbindd_response *response)
 {
 	struct winbindd_response lresponse;
 
diff --git a/nsswitch/winbind_client.h b/nsswitch/winbind_client.h
index d6b46fc..fd39ea3 100644
--- a/nsswitch/winbind_client.h
+++ b/nsswitch/winbind_client.h
@@ -35,11 +35,6 @@ struct winbindd_context *winbindd_ctx_create(void);
 void winbindd_ctx_free(struct winbindd_context *ctx);
 
 void winbindd_free_response(struct winbindd_response *response);
-NSS_STATUS winbindd_send_request(struct winbindd_context *ctx,
-				 int req_type, int need_priv,
-				 struct winbindd_request *request);
-NSS_STATUS winbindd_get_response(struct winbindd_context *ctx,
-				 struct winbindd_response *response);
 NSS_STATUS winbindd_request_response(struct winbindd_context *ctx,
 				     int req_type,
 				     struct winbindd_request *request,
diff --git a/nsswitch/winbind_nss_irix.c b/nsswitch/winbind_nss_irix.c
deleted file mode 100644
index 66fa4b5..0000000
--- a/nsswitch/winbind_nss_irix.c
+++ /dev/null
@@ -1,633 +0,0 @@
-/*
-   Unix SMB/CIFS implementation.
-
-   Windows NT Domain nsswitch module
-
-   Copyright (C) Tim Potter 2000
-   Copyright (C) James Peach 2006
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 3 of the License, or (at your option) any later version.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "winbind_client.h"
-
-#ifndef PRINTF_ATTRIBUTE
-#define PRINTF_ATTRIBUTE(m, n)
-#endif
-
-#ifndef HAVE_ASPRINTF_DECL
-/*PRINTFLIKE2 */
-int asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3);
-#endif
-
-#ifdef HAVE_NS_API_H
-#undef STATIC
-#undef DYNAMIC
-#include <ns_daemon.h>
-#endif
-
-/* Maximum number of users to pass back over the unix domain socket
-   per call. This is not a static limit on the total number of users
-   or groups returned in total. */
-
-#define MAX_GETPWENT_USERS 250
-#define MAX_GETGRENT_USERS 250
-
-/* Prototypes from wb_common.c */
-
-extern int winbindd_fd;
-
-#ifdef HAVE_NS_API_H
-
-/* IRIX version */
-
-static int send_next_request(nsd_file_t *, struct winbindd_request *);
-static int do_list(int state, nsd_file_t *rq);
-
-static nsd_file_t *current_rq = NULL;
-static int current_winbind_xid = 0;
-static int next_winbind_xid = 0;
-
-typedef struct winbind_xid {
-	int			xid;
-	nsd_file_t		*rq;
-	struct winbindd_request *request;
-	struct winbind_xid	*next;
-} winbind_xid_t;
-
-static winbind_xid_t *winbind_xids = (winbind_xid_t *)0;
-
-static int
-winbind_xid_new(int xid, nsd_file_t *rq, struct winbindd_request *request)
-{
-	winbind_xid_t *new;
-
-	nsd_logprintf(NSD_LOG_LOW,
-		"entering winbind_xid_new xid = %d rq = 0x%x, request = 0x%x\n",
-		xid, rq, request);
-	new = (winbind_xid_t *)nsd_calloc(1,sizeof(winbind_xid_t));
-	if (!new) {
-		nsd_logprintf(NSD_LOG_RESOURCE,"winbind_xid_new: failed malloc\n");
-		return NSD_ERROR;
-	}
-
-	new->xid = xid;
-	new->rq = rq;
-	new->request = request;
-	new->next = winbind_xids;
-	winbind_xids = new;
-
-	return NSD_CONTINUE;
-}
-
-/*
-** This routine will look down the xid list and return the request
-** associated with an xid.  We remove the record if it is found.
-*/
-nsd_file_t *
-winbind_xid_lookup(int xid, struct winbindd_request **requestp)
-{
-        winbind_xid_t **last, *dx;
-        nsd_file_t *result=0;
-
-        for (last = &winbind_xids, dx = winbind_xids; dx && (dx->xid != xid);
-            last = &dx->next, dx = dx->next);
-        if (dx) {
-                *last = dx->next;
-                result = dx->rq;
-		*requestp = dx->request;
-                SAFE_FREE(dx);
-        }
-	nsd_logprintf(NSD_LOG_LOW,
-		"entering winbind_xid_lookup xid = %d rq = 0x%x, request = 0x%x\n",
-		xid, result, dx->request);
-
-        return result;
-}
-
-static int
-winbind_startnext_timeout(nsd_file_t **rqp, nsd_times_t *to)
-{
-	nsd_file_t *rq;
-	struct winbindd_request *request;
-
-	nsd_logprintf(NSD_LOG_MIN, "timeout (winbind startnext)\n");
-	rq = to->t_file;
-	*rqp = rq;
-	nsd_timeout_remove(rq);
-	request = to->t_clientdata;
-	return(send_next_request(rq, request));
-}
-
-static void
-dequeue_request(void)
-{
-	nsd_file_t *rq;
-	struct winbindd_request *request;
-
-	/*
-	 * Check for queued requests
-	 */
-	if (winbind_xids) {
-	    nsd_logprintf(NSD_LOG_MIN, "timeout (winbind) unqueue xid %d\n",
-			current_winbind_xid);
-	    rq = winbind_xid_lookup(current_winbind_xid++, &request);
-	    /* cause a timeout on the queued request so we can send it */
-	    nsd_timeout_new(rq,1,winbind_startnext_timeout,request);
-	}
-}
-
-static int
-do_request(nsd_file_t *rq, struct winbindd_request *request)
-{
-	if (winbind_xids == NULL) {
-		/*
-		 * No outstanding requests.
-		 * Send off the request to winbindd
-		 */
-		nsd_logprintf(NSD_LOG_MIN, "lookup (winbind) sending request\n");
-		return(send_next_request(rq, request));
-	} else {
-		/*
-		 * Just queue it up for now - previous callout or timout
-		 * will start it up
-		 */
-		nsd_logprintf(NSD_LOG_MIN,
-			"lookup (winbind): queue request xid = %d\n",
-			next_winbind_xid);
-		return(winbind_xid_new(next_winbind_xid++, rq, request));
-	}
-}
-
-static int
-winbind_callback(nsd_file_t **rqp, int fd)
-{
-	struct winbindd_response response;
-	nsd_file_t *rq;
-	NSS_STATUS status;
-	char * result = NULL;
-	size_t rlen;
-
-	dequeue_request();
-
-	nsd_logprintf(NSD_LOG_MIN, "entering callback (winbind)\n");
-
-	rq = current_rq;
-	*rqp = rq;
-
-	nsd_timeout_remove(rq);
-	nsd_callback_remove(fd);
-
-	ZERO_STRUCT(response);
-	status = winbindd_get_response(&response);
-
-	if (status != NSS_STATUS_SUCCESS) {
-		/* free any extra data area in response structure */
-		winbindd_free_response(&response);
-		nsd_logprintf(NSD_LOG_MIN,
-			"callback (winbind) returning not found, status = %d\n",
-			status);
-
-		switch (status) {
-		    case NSS_STATUS_UNAVAIL:
-			rq->f_status = NS_UNAVAIL;
-			break;
-		    case NSS_STATUS_TRYAGAIN:
-			rq->f_status = NS_TRYAGAIN;
-			break;
-		    case NSS_STATUS_NOTFOUND:
-			/* FALLTHRU */
-		    default:
-			rq->f_status = NS_NOTFOUND;
-		}
-
-		return NSD_NEXT;
-	}
-
-	switch ((int)rq->f_cmd_data) {
-	    case WINBINDD_WINS_BYNAME:
-	    case WINBINDD_WINS_BYIP:
-		nsd_logprintf(NSD_LOG_MIN,
-			"callback (winbind) WINS_BYNAME | WINS_BYIP\n");
-
-		rlen = asprintf(&result, "%s\n", response.data.winsresp);
-		if (rlen == 0 || result == NULL) {
-			return NSD_ERROR;
-		}
-
-		winbindd_free_response(&response);
-
-		nsd_logprintf(NSD_LOG_MIN, "    %s\n", result);
-		nsd_set_result(rq, NS_SUCCESS, result, rlen, DYNAMIC);
-		return NSD_OK;
-
-	    case WINBINDD_GETPWUID:
-	    case WINBINDD_GETPWNAM:
-	    {
-	        struct winbindd_pw *pw = &response.data.pw;
-
-	        nsd_logprintf(NSD_LOG_MIN,
-			"callback (winbind) GETPWUID | GETPWUID\n");
-
-	        rlen = asprintf(&result,"%s:%s:%d:%d:%s:%s:%s\n",
-	                        pw->pw_name,
-	                        pw->pw_passwd,
-	                        pw->pw_uid,
-	                        pw->pw_gid,
-	                        pw->pw_gecos,
-	                        pw->pw_dir,
-	                        pw->pw_shell);
-	        if (rlen == 0 || result == NULL)
-	            return NSD_ERROR;
-
-	        winbindd_free_response(&response);
-
-	        nsd_logprintf(NSD_LOG_MIN, "    %s\n", result);
-	        nsd_set_result(rq, NS_SUCCESS, result, rlen, DYNAMIC);
-	        return NSD_OK;
-	    }
-
-	    case WINBINDD_GETGRNAM:
-	    case WINBINDD_GETGRGID:
-	    {
-	        const struct winbindd_gr *gr = &response.data.gr;
-	        const char * members;
-
-	        nsd_logprintf(NSD_LOG_MIN,
-			"callback (winbind) GETGRNAM | GETGRGID\n");
-
-	        if (gr->num_gr_mem && response.extra_data.data) {
-	                members = response.extra_data.data;
-	        } else {
-	                members = "";
-	        }
-
-	        rlen = asprintf(&result, "%s:%s:%d:%s\n",
-			    gr->gr_name, gr->gr_passwd, gr->gr_gid, members);
-	        if (rlen == 0 || result == NULL)
-	            return NSD_ERROR;
-
-	        winbindd_free_response(&response);
-
-	        nsd_logprintf(NSD_LOG_MIN, "    %s\n", result);
-	        nsd_set_result(rq, NS_SUCCESS, result, rlen, DYNAMIC);
-	        return NSD_OK;
-	    }
-
-	    case WINBINDD_SETGRENT:
-	    case WINBINDD_SETPWENT:
-		nsd_logprintf(NSD_LOG_MIN,
-			"callback (winbind) SETGRENT | SETPWENT\n");
-		winbindd_free_response(&response);
-		return(do_list(1,rq));
-
-	    case WINBINDD_GETGRENT:
-	    case WINBINDD_GETGRLST:
-	    {
-	        int entries;
-
-	        nsd_logprintf(NSD_LOG_MIN,
-		    "callback (winbind) GETGRENT | GETGRLIST %d responses\n",
-		    response.data.num_entries);
-
-	        if (response.data.num_entries) {
-	            const struct winbindd_gr *gr = &response.data.gr;
-	            const char * members;
-	            fstring grp_name;
-	            int     i;
-
-	            gr = (struct winbindd_gr *)response.extra_data.data;
-	            if (! gr ) {
-	                nsd_logprintf(NSD_LOG_MIN, "     no extra_data\n");
-	                winbindd_free_response(&response);
-	                return NSD_ERROR;
-	            }
-
-	            members = (char *)response.extra_data.data +
-			(response.data.num_entries * sizeof(struct winbindd_gr));
-
-	            for (i = 0; i < response.data.num_entries; i++) {
-	                snprintf(grp_name, sizeof(grp_name) - 1, "%s:%s:%d:",
-	                            gr->gr_name, gr->gr_passwd, gr->gr_gid);
-
-	                nsd_append_element(rq, NS_SUCCESS, result, rlen);
-	                nsd_append_result(rq, NS_SUCCESS,
-				&members[gr->gr_mem_ofs],
-	                        strlen(&members[gr->gr_mem_ofs]));
-
-	                /* Don't log the whole list, because it might be
-	                 * _really_ long and we probably don't want to clobber
-	                 * the log with it.
-	                 */
-	                nsd_logprintf(NSD_LOG_MIN, "    %s (...)\n", grp_name);
-
-	                gr++;
-	            }
-	        }
-
-	        entries = response.data.num_entries;
-	        winbindd_free_response(&response);
-	        if (entries < MAX_GETPWENT_USERS)
-	            return(do_list(2,rq));
-	        else
-	            return(do_list(1,rq));
-	    }
-
-	    case WINBINDD_GETPWENT:
-	    {
-		int entries;
-
-		nsd_logprintf(NSD_LOG_MIN,
-			"callback (winbind) GETPWENT  %d responses\n",
-			response.data.num_entries);
-
-		if (response.data.num_entries) {
-		    struct winbindd_pw *pw = &response.data.pw;
-		    int i;
-
-		    pw = (struct winbindd_pw *)response.extra_data.data;
-		    if (! pw ) {
-			nsd_logprintf(NSD_LOG_MIN, "     no extra_data\n");
-			winbindd_free_response(&response);
-			return NSD_ERROR;
-		    }
-		    for (i = 0; i < response.data.num_entries; i++) {
-			result = NULL;
-			rlen = asprintf(&result, "%s:%s:%d:%d:%s:%s:%s",
-					pw->pw_name,
-					pw->pw_passwd,
-					pw->pw_uid,
-					pw->pw_gid,
-					pw->pw_gecos,
-					pw->pw_dir,
-					pw->pw_shell);
-
-			if (rlen != 0 && result != NULL) {
-			    nsd_logprintf(NSD_LOG_MIN, "    %s\n",result);
-			    nsd_append_element(rq, NS_SUCCESS, result, rlen);
-			    free(result);
-			}
-
-			pw++;
-		    }
-		}
-
-		entries = response.data.num_entries;
-		winbindd_free_response(&response);
-		if (entries < MAX_GETPWENT_USERS)
-		    return(do_list(2,rq));
-		else
-		    return(do_list(1,rq));
-	    }
-
-	    case WINBINDD_ENDGRENT:
-	    case WINBINDD_ENDPWENT:
-		nsd_logprintf(NSD_LOG_MIN, "callback (winbind) ENDGRENT | ENDPWENT\n");
-		nsd_append_element(rq, NS_SUCCESS, "\n", 1);
-		winbindd_free_response(&response);
-		return NSD_NEXT;
-
-	    default:
-		winbindd_free_response(&response);
-		nsd_logprintf(NSD_LOG_MIN, "callback (winbind) invalid command %d\n", (int)rq->f_cmd_data);
-		return NSD_NEXT;
-	}


-- 
Samba Shared Repository



More information about the samba-cvs mailing list