6729ff
From 932490ae08578c37523e00e537017603ee00ce7c Mon Sep 17 00:00:00 2001
6729ff
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
6729ff
Date: Fri, 17 Jan 2014 14:29:03 +0100
6729ff
Subject: [PATCH 1/8] s3-libads: pass down local_service to
6729ff
 kerberos_return_pac().
6729ff
MIME-Version: 1.0
6729ff
Content-Type: text/plain; charset=UTF-8
6729ff
Content-Transfer-Encoding: 8bit
6729ff
6729ff
Guenther
6729ff
6729ff
Signed-off-by: Günther Deschner <gd@samba.org>
6729ff
Reviewed-by: Andreas Schneider <asn@samba.org>
6729ff
---
6729ff
 source3/libads/authdata.c       | 6 +-----
6729ff
 source3/libads/kerberos_proto.h | 1 +
6729ff
 source3/utils/net_ads.c         | 8 ++++++++
6729ff
 source3/winbindd/winbindd_pam.c | 9 +++++++++
6729ff
 4 files changed, 19 insertions(+), 5 deletions(-)
6729ff
6729ff
diff --git a/source3/libads/authdata.c b/source3/libads/authdata.c
6729ff
index 801e551..dd80dc2 100644
6729ff
--- a/source3/libads/authdata.c
6729ff
+++ b/source3/libads/authdata.c
6729ff
@@ -101,13 +101,13 @@ NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
6729ff
 			     bool add_netbios_addr,
6729ff
 			     time_t renewable_time,
6729ff
 			     const char *impersonate_princ_s,
6729ff
+			     const char *local_service,
6729ff
 			     struct PAC_LOGON_INFO **_logon_info)
6729ff
 {
6729ff
 	krb5_error_code ret;
6729ff
 	NTSTATUS status = NT_STATUS_INVALID_PARAMETER;
6729ff
 	DATA_BLOB tkt, tkt_wrapped, ap_rep, sesskey1;
6729ff
 	const char *auth_princ = NULL;
6729ff
-	const char *local_service = NULL;
6729ff
 	const char *cc = "MEMORY:kerberos_return_pac";
6729ff
 	struct auth_session_info *session_info;
6729ff
 	struct gensec_security *gensec_server_context;
6729ff
@@ -141,10 +141,6 @@ NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
6729ff
 	}
6729ff
 	NT_STATUS_HAVE_NO_MEMORY(auth_princ);
6729ff
 
6729ff
-	local_service = talloc_asprintf(mem_ctx, "%s$@%s",
6729ff
-					lp_netbios_name(), lp_realm());
6729ff
-	NT_STATUS_HAVE_NO_MEMORY(local_service);
6729ff
-
6729ff
 	ret = kerberos_kinit_password_ext(auth_princ,
6729ff
 					  pass,
6729ff
 					  time_offset,
6729ff
diff --git a/source3/libads/kerberos_proto.h b/source3/libads/kerberos_proto.h
6729ff
index 2559634..1151d66 100644
6729ff
--- a/source3/libads/kerberos_proto.h
6729ff
+++ b/source3/libads/kerberos_proto.h
6729ff
@@ -77,6 +77,7 @@ NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
6729ff
 			     bool add_netbios_addr,
6729ff
 			     time_t renewable_time,
6729ff
 			     const char *impersonate_princ_s,
6729ff
+			     const char *local_service,
6729ff
 			     struct PAC_LOGON_INFO **logon_info);
6729ff
 
6729ff
 /* The following definitions come from libads/krb5_setpw.c  */
6729ff
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
6729ff
index 89eebf3..5a073b1 100644
6729ff
--- a/source3/utils/net_ads.c
6729ff
+++ b/source3/utils/net_ads.c
6729ff
@@ -2604,6 +2604,7 @@ static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **ar
6729ff
 	NTSTATUS status;
6729ff
 	int ret = -1;
6729ff
 	const char *impersonate_princ_s = NULL;
6729ff
+	const char *local_service = NULL;
6729ff
 
6729ff
 	if (c->display_usage) {
6729ff
 		d_printf(  "%s\n"
6729ff
@@ -2623,6 +2624,12 @@ static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **ar
6729ff
 		impersonate_princ_s = argv[0];
6729ff
 	}
6729ff
 
6729ff
+	local_service = talloc_asprintf(mem_ctx, "%s$@%s",
6729ff
+					lp_netbios_name(), lp_realm());
6729ff
+	if (local_service == NULL) {
6729ff
+		goto out;
6729ff
+	}
6729ff
+
6729ff
 	c->opt_password = net_prompt_pass(c, c->opt_user_name);
6729ff
 
6729ff
 	status = kerberos_return_pac(mem_ctx,
6729ff
@@ -2636,6 +2643,7 @@ static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **ar
6729ff
 				     true,
6729ff
 				     2592000, /* one month */
6729ff
 				     impersonate_princ_s,
6729ff
+				     local_service,
6729ff
 				     &info;;
6729ff
 	if (!NT_STATUS_IS_OK(status)) {
6729ff
 		d_printf(_("failed to query kerberos PAC: %s\n"),
6729ff
diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c
6729ff
index 3f3ec70..61e2cef 100644
6729ff
--- a/source3/winbindd/winbindd_pam.c
6729ff
+++ b/source3/winbindd/winbindd_pam.c
6729ff
@@ -576,6 +576,7 @@ static NTSTATUS winbindd_raw_kerberos_login(TALLOC_CTX *mem_ctx,
6729ff
 	time_t time_offset = 0;
6729ff
 	const char *user_ccache_file;
6729ff
 	struct PAC_LOGON_INFO *logon_info = NULL;
6729ff
+	const char *local_service;
6729ff
 
6729ff
 	*info3 = NULL;
6729ff
 
6729ff
@@ -632,6 +633,13 @@ static NTSTATUS winbindd_raw_kerberos_login(TALLOC_CTX *mem_ctx,
6729ff
 		return NT_STATUS_NO_MEMORY;
6729ff
 	}
6729ff
 
6729ff
+	local_service = talloc_asprintf(mem_ctx, "%s$@%s",
6729ff
+					lp_netbios_name(), lp_realm());
6729ff
+	if (local_service == NULL) {
6729ff
+		return NT_STATUS_NO_MEMORY;
6729ff
+	}
6729ff
+
6729ff
+
6729ff
 	/* if this is a user ccache, we need to act as the user to let the krb5
6729ff
 	 * library handle the chown, etc. */
6729ff
 
6729ff
@@ -653,6 +661,7 @@ static NTSTATUS winbindd_raw_kerberos_login(TALLOC_CTX *mem_ctx,
6729ff
 				     true,
6729ff
 				     WINBINDD_PAM_AUTH_KRB5_RENEW_TIME,
6729ff
 				     NULL,
6729ff
+				     local_service,
6729ff
 				     &logon_info);
6729ff
 	if (user_ccache_file != NULL) {
6729ff
 		gain_root_privilege();
6729ff
-- 
6729ff
1.8.5.3
6729ff
6729ff
6729ff
From baed403983a5bb2e728249443fdfc9167a87f526 Mon Sep 17 00:00:00 2001
6729ff
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
6729ff
Date: Mon, 3 Mar 2014 12:14:51 +0100
6729ff
Subject: [PATCH 2/8] auth/kerberos: fix a typo.
6729ff
MIME-Version: 1.0
6729ff
Content-Type: text/plain; charset=UTF-8
6729ff
Content-Transfer-Encoding: 8bit
6729ff
6729ff
Guenther
6729ff
6729ff
Signed-off-by: Günther Deschner <gd@samba.org>
6729ff
Reviewed-by: Andreas Schneider <asn@samba.org>
6729ff
---
6729ff
 auth/kerberos/kerberos_pac.c | 2 +-
6729ff
 1 file changed, 1 insertion(+), 1 deletion(-)
6729ff
6729ff
diff --git a/auth/kerberos/kerberos_pac.c b/auth/kerberos/kerberos_pac.c
6729ff
index 81f7f21..8f55c8f 100644
6729ff
--- a/auth/kerberos/kerberos_pac.c
6729ff
+++ b/auth/kerberos/kerberos_pac.c
6729ff
@@ -79,7 +79,7 @@ krb5_error_code check_pac_checksum(DATA_BLOB pac_data,
6729ff
 }
6729ff
 
6729ff
 /**
6729ff
-* @brief Decode a blob containing a NDR envoded PAC structure
6729ff
+* @brief Decode a blob containing a NDR encoded PAC structure
6729ff
 *
6729ff
 * @param mem_ctx	  - The memory context
6729ff
 * @param pac_data_blob	  - The data blob containing the NDR encoded data
6729ff
-- 
6729ff
1.8.5.3
6729ff
6729ff
6729ff
From 9725a86e60bb6ef6e912621e81acc955ae2f70a8 Mon Sep 17 00:00:00 2001
6729ff
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
6729ff
Date: Mon, 10 Mar 2014 15:11:18 +0100
6729ff
Subject: [PATCH 3/8] s3-net: change the way impersonation principals are used
6729ff
 in "net ads kerberos pac".
6729ff
MIME-Version: 1.0
6729ff
Content-Type: text/plain; charset=UTF-8
6729ff
Content-Transfer-Encoding: 8bit
6729ff
6729ff
Guenther
6729ff
6729ff
Signed-off-by: Günther Deschner <gd@samba.org>
6729ff
Reviewed-by: Andreas Schneider <asn@samba.org>
6729ff
---
6729ff
 source3/utils/net_ads.c | 14 ++++++++++----
6729ff
 1 file changed, 10 insertions(+), 4 deletions(-)
6729ff
6729ff
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
6729ff
index 5a073b1..ac6346f 100644
6729ff
--- a/source3/utils/net_ads.c
6729ff
+++ b/source3/utils/net_ads.c
6729ff
@@ -2605,6 +2605,7 @@ static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **ar
6729ff
 	int ret = -1;
6729ff
 	const char *impersonate_princ_s = NULL;
6729ff
 	const char *local_service = NULL;
6729ff
+	int i;
6729ff
 
6729ff
 	if (c->display_usage) {
6729ff
 		d_printf(  "%s\n"
6729ff
@@ -2615,15 +2616,20 @@ static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **ar
6729ff
 		return 0;
6729ff
 	}
6729ff
 
6729ff
+	for (i=0; i
6729ff
+		if (strnequal(argv[i], "impersonate", strlen("impersonate"))) {
6729ff
+			impersonate_princ_s = get_string_param(argv[i]);
6729ff
+			if (impersonate_princ_s == NULL) {
6729ff
+				return -1;
6729ff
+			}
6729ff
+		}
6729ff
+	}
6729ff
+
6729ff
 	mem_ctx = talloc_init("net_ads_kerberos_pac");
6729ff
 	if (!mem_ctx) {
6729ff
 		goto out;
6729ff
 	}
6729ff
 
6729ff
-	if (argc > 0) {
6729ff
-		impersonate_princ_s = argv[0];
6729ff
-	}
6729ff
-
6729ff
 	local_service = talloc_asprintf(mem_ctx, "%s$@%s",
6729ff
 					lp_netbios_name(), lp_realm());
6729ff
 	if (local_service == NULL) {
6729ff
-- 
6729ff
1.8.5.3
6729ff
6729ff
6729ff
From 35a1ed22f65473fabb2f4846f6d2b50da1847f6a Mon Sep 17 00:00:00 2001
6729ff
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
6729ff
Date: Tue, 11 Mar 2014 16:34:36 +0100
6729ff
Subject: [PATCH 4/8] s3-net: allow to provide custom local_service in "net ads
6729ff
 kerberos pac".
6729ff
MIME-Version: 1.0
6729ff
Content-Type: text/plain; charset=UTF-8
6729ff
Content-Transfer-Encoding: 8bit
6729ff
6729ff
Guenther
6729ff
6729ff
Signed-off-by: Günther Deschner <gd@samba.org>
6729ff
Reviewed-by: Andreas Schneider <asn@samba.org>
6729ff
---
6729ff
 source3/utils/net_ads.c | 14 +++++++++++---
6729ff
 1 file changed, 11 insertions(+), 3 deletions(-)
6729ff
6729ff
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
6729ff
index ac6346f..c53c8c6 100644
6729ff
--- a/source3/utils/net_ads.c
6729ff
+++ b/source3/utils/net_ads.c
6729ff
@@ -2623,6 +2623,12 @@ static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **ar
6729ff
 				return -1;
6729ff
 			}
6729ff
 		}
6729ff
+		if (strnequal(argv[i], "local_service", strlen("local_service"))) {
6729ff
+			local_service = get_string_param(argv[i]);
6729ff
+			if (local_service == NULL) {
6729ff
+				return -1;
6729ff
+			}
6729ff
+		}
6729ff
 	}
6729ff
 
6729ff
 	mem_ctx = talloc_init("net_ads_kerberos_pac");
6729ff
@@ -2630,10 +2636,12 @@ static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **ar
6729ff
 		goto out;
6729ff
 	}
6729ff
 
6729ff
-	local_service = talloc_asprintf(mem_ctx, "%s$@%s",
6729ff
-					lp_netbios_name(), lp_realm());
6729ff
 	if (local_service == NULL) {
6729ff
-		goto out;
6729ff
+		local_service = talloc_asprintf(mem_ctx, "%s$@%s",
6729ff
+						lp_netbios_name(), lp_realm());
6729ff
+		if (local_service == NULL) {
6729ff
+			goto out;
6729ff
+		}
6729ff
 	}
6729ff
 
6729ff
 	c->opt_password = net_prompt_pass(c, c->opt_user_name);
6729ff
-- 
6729ff
1.8.5.3
6729ff
6729ff
6729ff
From 1270e35ba70a4e4881512d375c767023512f67bd Mon Sep 17 00:00:00 2001
6729ff
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
6729ff
Date: Fri, 21 Feb 2014 18:56:04 +0100
6729ff
Subject: [PATCH 5/8] s3-kerberos: return a full PAC in kerberos_return_pac().
6729ff
MIME-Version: 1.0
6729ff
Content-Type: text/plain; charset=UTF-8
6729ff
Content-Transfer-Encoding: 8bit
6729ff
6729ff
Guenther
6729ff
6729ff
Signed-off-by: Günther Deschner <gd@samba.org>
6729ff
Reviewed-by: Andreas Schneider <asn@samba.org>
6729ff
---
6729ff
 source3/libads/authdata.c       | 28 +++++++++++++++++-----------
6729ff
 source3/libads/kerberos_proto.h |  4 ++--
6729ff
 source3/utils/net_ads.c         | 17 ++++++++++++++++-
6729ff
 source3/winbindd/winbindd_pam.c | 22 +++++++++++++++++++++-
6729ff
 4 files changed, 56 insertions(+), 15 deletions(-)
6729ff
6729ff
diff --git a/source3/libads/authdata.c b/source3/libads/authdata.c
6729ff
index dd80dc2..53e40ef 100644
6729ff
--- a/source3/libads/authdata.c
6729ff
+++ b/source3/libads/authdata.c
6729ff
@@ -52,7 +52,7 @@ static NTSTATUS kerberos_fetch_pac(struct auth4_context *auth_ctx,
6729ff
 				   struct auth_session_info **session_info)
6729ff
 {
6729ff
 	TALLOC_CTX *tmp_ctx;
6729ff
-	struct PAC_LOGON_INFO *logon_info = NULL;
6729ff
+	struct PAC_DATA *pac_data = NULL;
6729ff
 	NTSTATUS status = NT_STATUS_INTERNAL_ERROR;
6729ff
 
6729ff
 	tmp_ctx = talloc_new(mem_ctx);
6729ff
@@ -61,16 +61,22 @@ static NTSTATUS kerberos_fetch_pac(struct auth4_context *auth_ctx,
6729ff
 	}
6729ff
 
6729ff
 	if (pac_blob) {
6729ff
-		status = kerberos_pac_logon_info(tmp_ctx, *pac_blob, NULL, NULL,
6729ff
-						 NULL, NULL, 0, &logon_info);
6729ff
+		status = kerberos_decode_pac(tmp_ctx,
6729ff
+					     *pac_blob,
6729ff
+					     NULL,
6729ff
+					     NULL,
6729ff
+					     NULL,
6729ff
+					     NULL,
6729ff
+					     0,
6729ff
+					     &pac_data);
6729ff
 		if (!NT_STATUS_IS_OK(status)) {
6729ff
 			goto done;
6729ff
 		}
6729ff
 	}
6729ff
 
6729ff
-	talloc_set_name_const(logon_info, "struct PAC_LOGON_INFO");
6729ff
+	talloc_set_name_const(pac_data, "struct PAC_DATA");
6729ff
 
6729ff
-	auth_ctx->private_data = talloc_steal(auth_ctx, logon_info);
6729ff
+	auth_ctx->private_data = talloc_steal(auth_ctx, pac_data);
6729ff
 	*session_info = talloc_zero(mem_ctx, struct auth_session_info);
6729ff
 	if (!*session_info) {
6729ff
 		status = NT_STATUS_NO_MEMORY;
6729ff
@@ -102,7 +108,7 @@ NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
6729ff
 			     time_t renewable_time,
6729ff
 			     const char *impersonate_princ_s,
6729ff
 			     const char *local_service,
6729ff
-			     struct PAC_LOGON_INFO **_logon_info)
6729ff
+			     struct PAC_DATA **_pac_data)
6729ff
 {
6729ff
 	krb5_error_code ret;
6729ff
 	NTSTATUS status = NT_STATUS_INVALID_PARAMETER;
6729ff
@@ -116,7 +122,7 @@ NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
6729ff
 	size_t idx = 0;
6729ff
 	struct auth4_context *auth_context;
6729ff
 	struct loadparm_context *lp_ctx;
6729ff
-	struct PAC_LOGON_INFO *logon_info = NULL;
6729ff
+	struct PAC_DATA *pac_data = NULL;
6729ff
 
6729ff
 	TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
6729ff
 	NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
6729ff
@@ -272,15 +278,15 @@ NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
6729ff
 		goto out;
6729ff
 	}
6729ff
 
6729ff
-	logon_info = talloc_get_type_abort(gensec_server_context->auth_context->private_data,
6729ff
-					   struct PAC_LOGON_INFO);
6729ff
-	if (logon_info == NULL) {
6729ff
+	pac_data = talloc_get_type_abort(gensec_server_context->auth_context->private_data,
6729ff
+					 struct PAC_DATA);
6729ff
+	if (pac_data == NULL) {
6729ff
 		DEBUG(1,("no PAC\n"));
6729ff
 		status = NT_STATUS_INVALID_PARAMETER;
6729ff
 		goto out;
6729ff
 	}
6729ff
 
6729ff
-	*_logon_info = talloc_move(mem_ctx, &logon_info);
6729ff
+	*_pac_data = talloc_move(mem_ctx, &pac_data);
6729ff
 
6729ff
 out:
6729ff
 	talloc_free(tmp_ctx);
6729ff
diff --git a/source3/libads/kerberos_proto.h b/source3/libads/kerberos_proto.h
6729ff
index 1151d66..b2f7486 100644
6729ff
--- a/source3/libads/kerberos_proto.h
6729ff
+++ b/source3/libads/kerberos_proto.h
6729ff
@@ -32,7 +32,7 @@
6729ff
 
6729ff
 #include "system/kerberos.h"
6729ff
 
6729ff
-struct PAC_LOGON_INFO;
6729ff
+struct PAC_DATA;
6729ff
 
6729ff
 #include "libads/ads_status.h"
6729ff
 
6729ff
@@ -78,7 +78,7 @@ NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
6729ff
 			     time_t renewable_time,
6729ff
 			     const char *impersonate_princ_s,
6729ff
 			     const char *local_service,
6729ff
-			     struct PAC_LOGON_INFO **logon_info);
6729ff
+			     struct PAC_DATA **pac_data);
6729ff
 
6729ff
 /* The following definitions come from libads/krb5_setpw.c  */
6729ff
 
6729ff
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
6729ff
index c53c8c6..19da6da 100644
6729ff
--- a/source3/utils/net_ads.c
6729ff
+++ b/source3/utils/net_ads.c
6729ff
@@ -2600,6 +2600,7 @@ static int net_ads_kerberos_renew(struct net_context *c, int argc, const char **
6729ff
 static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **argv)
6729ff
 {
6729ff
 	struct PAC_LOGON_INFO *info = NULL;
6729ff
+	struct PAC_DATA *pac_data = NULL;
6729ff
 	TALLOC_CTX *mem_ctx = NULL;
6729ff
 	NTSTATUS status;
6729ff
 	int ret = -1;
6729ff
@@ -2658,13 +2659,27 @@ static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **ar
6729ff
 				     2592000, /* one month */
6729ff
 				     impersonate_princ_s,
6729ff
 				     local_service,
6729ff
-				     &info;;
6729ff
+				     &pac_data);
6729ff
 	if (!NT_STATUS_IS_OK(status)) {
6729ff
 		d_printf(_("failed to query kerberos PAC: %s\n"),
6729ff
 			nt_errstr(status));
6729ff
 		goto out;
6729ff
 	}
6729ff
 
6729ff
+	for (i=0; i < pac_data->num_buffers; i++) {
6729ff
+
6729ff
+		if (pac_data->buffers[i].type != PAC_TYPE_LOGON_INFO) {
6729ff
+			continue;
6729ff
+		}
6729ff
+
6729ff
+		info = pac_data->buffers[i].info->logon_info.info;
6729ff
+		if (!info) {
6729ff
+			goto out;
6729ff
+		}
6729ff
+
6729ff
+		break;
6729ff
+	}
6729ff
+
6729ff
 	if (info) {
6729ff
 		const char *s;
6729ff
 		s = NDR_PRINT_STRUCT_STRING(mem_ctx, PAC_LOGON_INFO, info);
6729ff
diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c
6729ff
index 61e2cef..a8daae51 100644
6729ff
--- a/source3/winbindd/winbindd_pam.c
6729ff
+++ b/source3/winbindd/winbindd_pam.c
6729ff
@@ -576,7 +576,9 @@ static NTSTATUS winbindd_raw_kerberos_login(TALLOC_CTX *mem_ctx,
6729ff
 	time_t time_offset = 0;
6729ff
 	const char *user_ccache_file;
6729ff
 	struct PAC_LOGON_INFO *logon_info = NULL;
6729ff
+	struct PAC_DATA *pac_data = NULL;
6729ff
 	const char *local_service;
6729ff
+	int i;
6729ff
 
6729ff
 	*info3 = NULL;
6729ff
 
6729ff
@@ -662,7 +664,7 @@ static NTSTATUS winbindd_raw_kerberos_login(TALLOC_CTX *mem_ctx,
6729ff
 				     WINBINDD_PAM_AUTH_KRB5_RENEW_TIME,
6729ff
 				     NULL,
6729ff
 				     local_service,
6729ff
-				     &logon_info);
6729ff
+				     &pac_data);
6729ff
 	if (user_ccache_file != NULL) {
6729ff
 		gain_root_privilege();
6729ff
 	}
6729ff
@@ -673,6 +675,24 @@ static NTSTATUS winbindd_raw_kerberos_login(TALLOC_CTX *mem_ctx,
6729ff
 		goto failed;
6729ff
 	}
6729ff
 
6729ff
+	if (pac_data == NULL) {
6729ff
+		goto failed;
6729ff
+	}
6729ff
+
6729ff
+	for (i=0; i < pac_data->num_buffers; i++) {
6729ff
+
6729ff
+		if (pac_data->buffers[i].type != PAC_TYPE_LOGON_INFO) {
6729ff
+			continue;
6729ff
+		}
6729ff
+
6729ff
+		logon_info = pac_data->buffers[i].info->logon_info.info;
6729ff
+		if (!logon_info) {
6729ff
+			return NT_STATUS_INVALID_PARAMETER;
6729ff
+		}
6729ff
+
6729ff
+		break;
6729ff
+	}
6729ff
+
6729ff
 	*info3 = &logon_info->info3;
6729ff
 
6729ff
 	DEBUG(10,("winbindd_raw_kerberos_login: winbindd validated ticket of %s\n",
6729ff
-- 
6729ff
1.8.5.3
6729ff
6729ff
6729ff
From a8c2807a26d2f1ff094ed7ea5724c0394f79b888 Mon Sep 17 00:00:00 2001
6729ff
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
6729ff
Date: Tue, 11 Mar 2014 18:07:11 +0100
6729ff
Subject: [PATCH 6/8] s3-kerberos: let kerberos_return_pac() return a PAC
6729ff
 container.
6729ff
MIME-Version: 1.0
6729ff
Content-Type: text/plain; charset=UTF-8
6729ff
Content-Transfer-Encoding: 8bit
6729ff
6729ff
Guenther
6729ff
6729ff
Signed-off-by: Günther Deschner <gd@samba.org>
6729ff
Reviewed-by: Andreas Schneider <asn@samba.org>
6729ff
---
6729ff
 source3/libads/authdata.c       | 29 +++++++++++++++++++++--------
6729ff
 source3/libads/kerberos_proto.h |  7 ++++++-
6729ff
 source3/utils/net_ads.c         |  5 ++++-
6729ff
 source3/winbindd/winbindd_pam.c |  8 +++++++-
6729ff
 4 files changed, 38 insertions(+), 11 deletions(-)
6729ff
6729ff
diff --git a/source3/libads/authdata.c b/source3/libads/authdata.c
6729ff
index 53e40ef..276408d 100644
6729ff
--- a/source3/libads/authdata.c
6729ff
+++ b/source3/libads/authdata.c
6729ff
@@ -53,6 +53,7 @@ static NTSTATUS kerberos_fetch_pac(struct auth4_context *auth_ctx,
6729ff
 {
6729ff
 	TALLOC_CTX *tmp_ctx;
6729ff
 	struct PAC_DATA *pac_data = NULL;
6729ff
+	struct PAC_DATA_CTR *pac_data_ctr = NULL;
6729ff
 	NTSTATUS status = NT_STATUS_INTERNAL_ERROR;
6729ff
 
6729ff
 	tmp_ctx = talloc_new(mem_ctx);
6729ff
@@ -74,9 +75,21 @@ static NTSTATUS kerberos_fetch_pac(struct auth4_context *auth_ctx,
6729ff
 		}
6729ff
 	}
6729ff
 
6729ff
-	talloc_set_name_const(pac_data, "struct PAC_DATA");
6729ff
+	pac_data_ctr = talloc(mem_ctx, struct PAC_DATA_CTR);
6729ff
+	if (pac_data_ctr == NULL) {
6729ff
+		status = NT_STATUS_NO_MEMORY;
6729ff
+		goto done;
6729ff
+	}
6729ff
+
6729ff
+	talloc_set_name_const(pac_data_ctr, "struct PAC_DATA_CTR");
6729ff
+
6729ff
+	pac_data_ctr->pac_data = talloc_steal(pac_data_ctr, pac_data);
6729ff
+	pac_data_ctr->pac_blob = data_blob_talloc(pac_data_ctr,
6729ff
+						  pac_blob->data,
6729ff
+						  pac_blob->length);
6729ff
+
6729ff
+	auth_ctx->private_data = talloc_steal(auth_ctx, pac_data_ctr);
6729ff
 
6729ff
-	auth_ctx->private_data = talloc_steal(auth_ctx, pac_data);
6729ff
 	*session_info = talloc_zero(mem_ctx, struct auth_session_info);
6729ff
 	if (!*session_info) {
6729ff
 		status = NT_STATUS_NO_MEMORY;
6729ff
@@ -108,7 +121,7 @@ NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
6729ff
 			     time_t renewable_time,
6729ff
 			     const char *impersonate_princ_s,
6729ff
 			     const char *local_service,
6729ff
-			     struct PAC_DATA **_pac_data)
6729ff
+			     struct PAC_DATA_CTR **_pac_data_ctr)
6729ff
 {
6729ff
 	krb5_error_code ret;
6729ff
 	NTSTATUS status = NT_STATUS_INVALID_PARAMETER;
6729ff
@@ -122,7 +135,7 @@ NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
6729ff
 	size_t idx = 0;
6729ff
 	struct auth4_context *auth_context;
6729ff
 	struct loadparm_context *lp_ctx;
6729ff
-	struct PAC_DATA *pac_data = NULL;
6729ff
+	struct PAC_DATA_CTR *pac_data_ctr = NULL;
6729ff
 
6729ff
 	TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
6729ff
 	NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
6729ff
@@ -278,15 +291,15 @@ NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
6729ff
 		goto out;
6729ff
 	}
6729ff
 
6729ff
-	pac_data = talloc_get_type_abort(gensec_server_context->auth_context->private_data,
6729ff
-					 struct PAC_DATA);
6729ff
-	if (pac_data == NULL) {
6729ff
+	pac_data_ctr = talloc_get_type_abort(gensec_server_context->auth_context->private_data,
6729ff
+					     struct PAC_DATA_CTR);
6729ff
+	if (pac_data_ctr == NULL) {
6729ff
 		DEBUG(1,("no PAC\n"));
6729ff
 		status = NT_STATUS_INVALID_PARAMETER;
6729ff
 		goto out;
6729ff
 	}
6729ff
 
6729ff
-	*_pac_data = talloc_move(mem_ctx, &pac_data);
6729ff
+	*_pac_data_ctr = talloc_move(mem_ctx, &pac_data_ctr);
6729ff
 
6729ff
 out:
6729ff
 	talloc_free(tmp_ctx);
6729ff
diff --git a/source3/libads/kerberos_proto.h b/source3/libads/kerberos_proto.h
6729ff
index b2f7486..3d0ad4b 100644
6729ff
--- a/source3/libads/kerberos_proto.h
6729ff
+++ b/source3/libads/kerberos_proto.h
6729ff
@@ -34,6 +34,11 @@
6729ff
 
6729ff
 struct PAC_DATA;
6729ff
 
6729ff
+struct PAC_DATA_CTR {
6729ff
+	DATA_BLOB pac_blob;
6729ff
+	struct PAC_DATA *pac_data;
6729ff
+};
6729ff
+
6729ff
 #include "libads/ads_status.h"
6729ff
 
6729ff
 /* The following definitions come from libads/kerberos.c  */
6729ff
@@ -78,7 +83,7 @@ NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
6729ff
 			     time_t renewable_time,
6729ff
 			     const char *impersonate_princ_s,
6729ff
 			     const char *local_service,
6729ff
-			     struct PAC_DATA **pac_data);
6729ff
+			     struct PAC_DATA_CTR **pac_data_ctr);
6729ff
 
6729ff
 /* The following definitions come from libads/krb5_setpw.c  */
6729ff
 
6729ff
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
6729ff
index 19da6da..19c28b1 100644
6729ff
--- a/source3/utils/net_ads.c
6729ff
+++ b/source3/utils/net_ads.c
6729ff
@@ -2601,6 +2601,7 @@ static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **ar
6729ff
 {
6729ff
 	struct PAC_LOGON_INFO *info = NULL;
6729ff
 	struct PAC_DATA *pac_data = NULL;
6729ff
+	struct PAC_DATA_CTR *pac_data_ctr = NULL;
6729ff
 	TALLOC_CTX *mem_ctx = NULL;
6729ff
 	NTSTATUS status;
6729ff
 	int ret = -1;
6729ff
@@ -2659,13 +2660,15 @@ static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **ar
6729ff
 				     2592000, /* one month */
6729ff
 				     impersonate_princ_s,
6729ff
 				     local_service,
6729ff
-				     &pac_data);
6729ff
+				     &pac_data_ctr);
6729ff
 	if (!NT_STATUS_IS_OK(status)) {
6729ff
 		d_printf(_("failed to query kerberos PAC: %s\n"),
6729ff
 			nt_errstr(status));
6729ff
 		goto out;
6729ff
 	}
6729ff
 
6729ff
+	pac_data = pac_data_ctr->pac_data;
6729ff
+
6729ff
 	for (i=0; i < pac_data->num_buffers; i++) {
6729ff
 
6729ff
 		if (pac_data->buffers[i].type != PAC_TYPE_LOGON_INFO) {
6729ff
diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c
6729ff
index a8daae51..b41291e 100644
6729ff
--- a/source3/winbindd/winbindd_pam.c
6729ff
+++ b/source3/winbindd/winbindd_pam.c
6729ff
@@ -577,6 +577,7 @@ static NTSTATUS winbindd_raw_kerberos_login(TALLOC_CTX *mem_ctx,
6729ff
 	const char *user_ccache_file;
6729ff
 	struct PAC_LOGON_INFO *logon_info = NULL;
6729ff
 	struct PAC_DATA *pac_data = NULL;
6729ff
+	struct PAC_DATA_CTR *pac_data_ctr = NULL;
6729ff
 	const char *local_service;
6729ff
 	int i;
6729ff
 
6729ff
@@ -664,7 +665,7 @@ static NTSTATUS winbindd_raw_kerberos_login(TALLOC_CTX *mem_ctx,
6729ff
 				     WINBINDD_PAM_AUTH_KRB5_RENEW_TIME,
6729ff
 				     NULL,
6729ff
 				     local_service,
6729ff
-				     &pac_data);
6729ff
+				     &pac_data_ctr);
6729ff
 	if (user_ccache_file != NULL) {
6729ff
 		gain_root_privilege();
6729ff
 	}
6729ff
@@ -675,6 +676,11 @@ static NTSTATUS winbindd_raw_kerberos_login(TALLOC_CTX *mem_ctx,
6729ff
 		goto failed;
6729ff
 	}
6729ff
 
6729ff
+	if (pac_data_ctr == NULL) {
6729ff
+		goto failed;
6729ff
+	}
6729ff
+
6729ff
+	pac_data = pac_data_ctr->pac_data;
6729ff
 	if (pac_data == NULL) {
6729ff
 		goto failed;
6729ff
 	}
6729ff
-- 
6729ff
1.8.5.3
6729ff
6729ff
6729ff
From 9e01f3cbc4752539128e5452f567ff2e73c3ec9d Mon Sep 17 00:00:00 2001
6729ff
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
6729ff
Date: Tue, 11 Mar 2014 18:14:39 +0100
6729ff
Subject: [PATCH 7/8] s3-net: modify the current "net ads kerberos pac"
6729ff
 command.
6729ff
MIME-Version: 1.0
6729ff
Content-Type: text/plain; charset=UTF-8
6729ff
Content-Transfer-Encoding: 8bit
6729ff
6729ff
Rename it to "net ads kerberos pac dump" and add a "type=num" option to allow
6729ff
dumping of individial pac buffer types. Ommitting type= or using type=0 will
6729ff
dump the whole PAC structure on stdout.
6729ff
6729ff
Guenther
6729ff
6729ff
Signed-off-by: Günther Deschner <gd@samba.org>
6729ff
Reviewed-by: Andreas Schneider <asn@samba.org>
6729ff
---
6729ff
 source3/utils/net_ads.c | 115 ++++++++++++++++++++++++++++++++----------------
6729ff
 1 file changed, 77 insertions(+), 38 deletions(-)
6729ff
6729ff
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
6729ff
index 19c28b1..f54cf23 100644
6729ff
--- a/source3/utils/net_ads.c
6729ff
+++ b/source3/utils/net_ads.c
6729ff
@@ -2597,27 +2597,15 @@ static int net_ads_kerberos_renew(struct net_context *c, int argc, const char **
6729ff
 	return ret;
6729ff
 }
6729ff
 
6729ff
-static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **argv)
6729ff
+static int net_ads_kerberos_pac_common(struct net_context *c, int argc, const char **argv,
6729ff
+				       struct PAC_DATA_CTR **pac_data_ctr)
6729ff
 {
6729ff
-	struct PAC_LOGON_INFO *info = NULL;
6729ff
-	struct PAC_DATA *pac_data = NULL;
6729ff
-	struct PAC_DATA_CTR *pac_data_ctr = NULL;
6729ff
-	TALLOC_CTX *mem_ctx = NULL;
6729ff
 	NTSTATUS status;
6729ff
 	int ret = -1;
6729ff
 	const char *impersonate_princ_s = NULL;
6729ff
 	const char *local_service = NULL;
6729ff
 	int i;
6729ff
 
6729ff
-	if (c->display_usage) {
6729ff
-		d_printf(  "%s\n"
6729ff
-			   "net ads kerberos pac [impersonation_principal]\n"
6729ff
-			   "    %s\n",
6729ff
-			 _("Usage:"),
6729ff
-			 _("Dump the Kerberos PAC"));
6729ff
-		return 0;
6729ff
-	}
6729ff
-
6729ff
 	for (i=0; i
6729ff
 		if (strnequal(argv[i], "impersonate", strlen("impersonate"))) {
6729ff
 			impersonate_princ_s = get_string_param(argv[i]);
6729ff
@@ -2633,13 +2621,8 @@ static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **ar
6729ff
 		}
6729ff
 	}
6729ff
 
6729ff
-	mem_ctx = talloc_init("net_ads_kerberos_pac");
6729ff
-	if (!mem_ctx) {
6729ff
-		goto out;
6729ff
-	}
6729ff
-
6729ff
 	if (local_service == NULL) {
6729ff
-		local_service = talloc_asprintf(mem_ctx, "%s$@%s",
6729ff
+		local_service = talloc_asprintf(c, "%s$@%s",
6729ff
 						lp_netbios_name(), lp_realm());
6729ff
 		if (local_service == NULL) {
6729ff
 			goto out;
6729ff
@@ -2648,7 +2631,7 @@ static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **ar
6729ff
 
6729ff
 	c->opt_password = net_prompt_pass(c, c->opt_user_name);
6729ff
 
6729ff
-	status = kerberos_return_pac(mem_ctx,
6729ff
+	status = kerberos_return_pac(c,
6729ff
 				     c->opt_user_name,
6729ff
 				     c->opt_password,
6729ff
 				     0,
6729ff
@@ -2660,39 +2643,95 @@ static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **ar
6729ff
 				     2592000, /* one month */
6729ff
 				     impersonate_princ_s,
6729ff
 				     local_service,
6729ff
-				     &pac_data_ctr);
6729ff
+				     pac_data_ctr);
6729ff
 	if (!NT_STATUS_IS_OK(status)) {
6729ff
 		d_printf(_("failed to query kerberos PAC: %s\n"),
6729ff
 			nt_errstr(status));
6729ff
 		goto out;
6729ff
 	}
6729ff
 
6729ff
-	pac_data = pac_data_ctr->pac_data;
6729ff
+	ret = 0;
6729ff
+ out:
6729ff
+	return ret;
6729ff
+}
6729ff
 
6729ff
-	for (i=0; i < pac_data->num_buffers; i++) {
6729ff
+static int net_ads_kerberos_pac_dump(struct net_context *c, int argc, const char **argv)
6729ff
+{
6729ff
+	struct PAC_DATA_CTR *pac_data_ctr = NULL;
6729ff
+	int i;
6729ff
+	int ret = -1;
6729ff
+	enum PAC_TYPE type = 0;
6729ff
 
6729ff
-		if (pac_data->buffers[i].type != PAC_TYPE_LOGON_INFO) {
6729ff
-			continue;
6729ff
+	if (c->display_usage) {
6729ff
+		d_printf(  "%s\n"
6729ff
+			   "net ads kerberos pac dump [impersonate=string] [local_service=string] [pac_buffer_type=int]\n"
6729ff
+			   "    %s\n",
6729ff
+			 _("Usage:"),
6729ff
+			 _("Dump the Kerberos PAC"));
6729ff
+		return -1;
6729ff
+	}
6729ff
+
6729ff
+	for (i=0; i
6729ff
+		if (strnequal(argv[i], "pac_buffer_type", strlen("pac_buffer_type"))) {
6729ff
+			type = get_int_param(argv[i]);
6729ff
 		}
6729ff
+	}
6729ff
 
6729ff
-		info = pac_data->buffers[i].info->logon_info.info;
6729ff
-		if (!info) {
6729ff
-			goto out;
6729ff
+	ret = net_ads_kerberos_pac_common(c, argc, argv, &pac_data_ctr);
6729ff
+	if (ret) {
6729ff
+		return ret;
6729ff
+	}
6729ff
+
6729ff
+	if (type == 0) {
6729ff
+
6729ff
+		char *s = NULL;
6729ff
+
6729ff
+		s = NDR_PRINT_STRUCT_STRING(c, PAC_DATA,
6729ff
+			pac_data_ctr->pac_data);
6729ff
+		if (s != NULL) {
6729ff
+			d_printf(_("The Pac: %s\n"), s);
6729ff
+			talloc_free(s);
6729ff
 		}
6729ff
 
6729ff
-		break;
6729ff
+		return 0;
6729ff
 	}
6729ff
 
6729ff
-	if (info) {
6729ff
-		const char *s;
6729ff
-		s = NDR_PRINT_STRUCT_STRING(mem_ctx, PAC_LOGON_INFO, info);
6729ff
-		d_printf(_("The Pac: %s\n"), s);
6729ff
+	for (i=0; i < pac_data_ctr->pac_data->num_buffers; i++) {
6729ff
+
6729ff
+		char *s = NULL;
6729ff
+
6729ff
+		if (pac_data_ctr->pac_data->buffers[i].type != type) {
6729ff
+			continue;
6729ff
+		}
6729ff
+
6729ff
+		s = NDR_PRINT_UNION_STRING(c, PAC_INFO, type,
6729ff
+				pac_data_ctr->pac_data->buffers[i].info);
6729ff
+		if (s != NULL) {
6729ff
+			d_printf(_("The Pac: %s\n"), s);
6729ff
+			talloc_free(s);
6729ff
+		}
6729ff
+		break;
6729ff
 	}
6729ff
 
6729ff
-	ret = 0;
6729ff
- out:
6729ff
-	TALLOC_FREE(mem_ctx);
6729ff
-	return ret;
6729ff
+	return 0;
6729ff
+}
6729ff
+
6729ff
+static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **argv)
6729ff
+{
6729ff
+	struct functable func[] = {
6729ff
+		{
6729ff
+			"dump",
6729ff
+			net_ads_kerberos_pac_dump,
6729ff
+			NET_TRANSPORT_ADS,
6729ff
+			N_("Dump Kerberos PAC"),
6729ff
+			N_("net ads kerberos pac dump\n"
6729ff
+			   "    Dump a Kerberos PAC to stdout")
6729ff
+		},
6729ff
+
6729ff
+		{NULL, NULL, 0, NULL, NULL}
6729ff
+	};
6729ff
+
6729ff
+	return net_run_function(c, argc, argv, "net ads kerberos pac", func);
6729ff
 }
6729ff
 
6729ff
 static int net_ads_kerberos_kinit(struct net_context *c, int argc, const char **argv)
6729ff
-- 
6729ff
1.8.5.3
6729ff
6729ff
6729ff
From 91ceace4ee8fd141cac5dbe5282bed141c38bee7 Mon Sep 17 00:00:00 2001
6729ff
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
6729ff
Date: Tue, 11 Mar 2014 18:16:40 +0100
6729ff
Subject: [PATCH 8/8] s3-net: add a new "net ads kerberos pac save" tool.
6729ff
MIME-Version: 1.0
6729ff
Content-Type: text/plain; charset=UTF-8
6729ff
Content-Transfer-Encoding: 8bit
6729ff
6729ff
Use "filename=string" to define a file where to save the unencrypted PAC to.
6729ff
6729ff
Guenther
6729ff
6729ff
Signed-off-by: Günther Deschner <gd@samba.org>
6729ff
Reviewed-by: Andreas Schneider <asn@samba.org>
6729ff
---
6729ff
 source3/utils/net_ads.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++
6729ff
 1 file changed, 52 insertions(+)
6729ff
6729ff
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
6729ff
index f54cf23..8b8e719 100644
6729ff
--- a/source3/utils/net_ads.c
6729ff
+++ b/source3/utils/net_ads.c
6729ff
@@ -2716,6 +2716,50 @@ static int net_ads_kerberos_pac_dump(struct net_context *c, int argc, const char
6729ff
 	return 0;
6729ff
 }
6729ff
 
6729ff
+static int net_ads_kerberos_pac_save(struct net_context *c, int argc, const char **argv)
6729ff
+{
6729ff
+	struct PAC_DATA_CTR *pac_data_ctr = NULL;
6729ff
+	char *filename = NULL;
6729ff
+	int ret = -1;
6729ff
+	int i;
6729ff
+
6729ff
+	if (c->display_usage) {
6729ff
+		d_printf(  "%s\n"
6729ff
+			   "net ads kerberos pac save [impersonate=string] [local_service=string] [filename=string]\n"
6729ff
+			   "    %s\n",
6729ff
+			 _("Usage:"),
6729ff
+			 _("Save the Kerberos PAC"));
6729ff
+		return -1;
6729ff
+	}
6729ff
+
6729ff
+	for (i=0; i
6729ff
+		if (strnequal(argv[i], "filename", strlen("filename"))) {
6729ff
+			filename = get_string_param(argv[i]);
6729ff
+			if (filename == NULL) {
6729ff
+				return -1;
6729ff
+			}
6729ff
+		}
6729ff
+	}
6729ff
+
6729ff
+	ret = net_ads_kerberos_pac_common(c, argc, argv, &pac_data_ctr);
6729ff
+	if (ret) {
6729ff
+		return ret;
6729ff
+	}
6729ff
+
6729ff
+	if (filename == NULL) {
6729ff
+		d_printf(_("please define \"filename=<filename>\" to save the PAC\n"));
6729ff
+		return -1;
6729ff
+	}
6729ff
+
6729ff
+	/* save the raw format */
6729ff
+	if (!file_save(filename, pac_data_ctr->pac_blob.data, pac_data_ctr->pac_blob.length)) {
6729ff
+		d_printf(_("failed to save PAC in %s\n"), filename);
6729ff
+		return -1;
6729ff
+	}
6729ff
+
6729ff
+	return 0;
6729ff
+}
6729ff
+
6729ff
 static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **argv)
6729ff
 {
6729ff
 	struct functable func[] = {
6729ff
@@ -2727,6 +2771,14 @@ static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **ar
6729ff
 			N_("net ads kerberos pac dump\n"
6729ff
 			   "    Dump a Kerberos PAC to stdout")
6729ff
 		},
6729ff
+		{
6729ff
+			"save",
6729ff
+			net_ads_kerberos_pac_save,
6729ff
+			NET_TRANSPORT_ADS,
6729ff
+			N_("Save Kerberos PAC"),
6729ff
+			N_("net ads kerberos pac save\n"
6729ff
+			   "    Save a Kerberos PAC in a file")
6729ff
+		},
6729ff
 
6729ff
 		{NULL, NULL, 0, NULL, NULL}
6729ff
 	};
6729ff
-- 
6729ff
1.8.5.3
6729ff