s3-winbind: Implemented samr backend function common_password_policy.
authorAndreas Schneider <asn@samba.org>
Wed, 9 Jun 2010 12:41:54 +0000 (14:41 +0200)
committerAndreas Schneider <asn@samba.org>
Mon, 5 Jul 2010 13:59:07 +0000 (15:59 +0200)
source3/winbindd/winbindd_samr.c

index 12fe447bfef95d21e46df5595c4219c58ec826b5..337ff99d42912af4775dacd72b54438219a50c2d 100644 (file)
@@ -1163,10 +1163,40 @@ error:
 
 static NTSTATUS common_password_policy(struct winbindd_domain *domain,
                                       TALLOC_CTX *mem_ctx,
-                                      struct samr_DomInfo1 *policy)
+                                      struct samr_DomInfo1 *passwd_policy)
 {
-       /* TODO FIXME */
-       return NT_STATUS_NOT_IMPLEMENTED;
+       struct rpc_pipe_client *samr_pipe;
+       struct policy_handle dom_pol;
+       union samr_DomainInfo *info = NULL;
+       TALLOC_CTX *tmp_ctx;
+       NTSTATUS status;
+
+       DEBUG(3,("samr: password policy\n"));
+
+       tmp_ctx = talloc_stackframe();
+       if (tmp_ctx == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       status = open_internal_samr_conn(tmp_ctx, domain, &samr_pipe, &dom_pol);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto error;
+       }
+
+       status = rpccli_samr_QueryDomainInfo(samr_pipe,
+                                            mem_ctx,
+                                            &dom_pol,
+                                            1,
+                                            &info);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto error;
+       }
+
+       *passwd_policy = info->info1;
+
+error:
+       TALLOC_FREE(tmp_ctx);
+       return status;
 }
 
 /* Lookup groups a user is a member of.  I wish Unix had a call like this! */