idl: Improve MS-PAC IDL
authorSimo Sorce <idra@samba.org>
Fri, 21 Oct 2011 20:10:43 +0000 (16:10 -0400)
committerGünther Deschner <gd@samba.org>
Mon, 24 Oct 2011 17:19:28 +0000 (19:19 +0200)
Change some misleading variable names to reflect the actual function.
Add missing field name/types previously marked as unkown.

Signed-off-by: Günther Deschner <gd@samba.org>
Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Mon Oct 24 19:19:28 CEST 2011 on sn-devel-104

12 files changed:
auth/auth_sam_reply.c
librpc/idl/netlogon.idl
source3/auth/auth_util.c
source3/auth/server_info.c
source3/auth/user_krb5.c
source3/rpc_client/util_netlogon.c
source3/rpc_server/rpc_server.c
source3/winbindd/winbindd_pam.c
source4/auth/ntlm/auth_winbind.c
source4/torture/rpc/samsync.c
source4/winbind/wb_pam_auth.c
source4/winbind/wb_samba3_cmd.c

index 59fcf7ad5d3affef0e5e9c5a9985e983233b9423..00e04b941edbefec1babc5846ec96107dee4f36a 100644 (file)
@@ -59,9 +59,9 @@ NTSTATUS auth_convert_user_info_dc_sambaseinfo(TALLOC_CTX *mem_ctx,
 
        info = user_info_dc->info;
 
-       sam->last_logon = info->last_logon;
-       sam->last_logoff =  info->last_logoff;
-       sam->acct_expiry = info->acct_expiry;
+       sam->logon_time = info->last_logon;
+       sam->logoff_time =  info->last_logoff;
+       sam->kickoff_time = info->acct_expiry;
        sam->last_password_change = info->last_password_change;
        sam->allow_password_change = info->allow_password_change;
        sam->force_password_change = info->force_password_change;
@@ -107,9 +107,12 @@ NTSTATUS auth_convert_user_info_dc_sambaseinfo(TALLOC_CTX *mem_ctx,
        }
        sam->acct_flags = user_info_dc->info->acct_flags;
        sam->logon_server.string = user_info_dc->info->logon_server;
-       sam->domain.string = user_info_dc->info->domain_name;
-
-       ZERO_STRUCT(sam->unknown);
+       sam->logon_domain.string = user_info_dc->info->domain_name;
+       sam->sub_auth_status = 0;
+       sam->last_successful_logon = 0;
+       sam->last_failed_logon = 0;
+       sam->failed_logon_count = 0;
+       sam->reserved = 0;
 
        ZERO_STRUCT(sam->key);
        if (user_info_dc->user_session_key.length == sizeof(sam->key.key)) {
@@ -198,8 +201,8 @@ NTSTATUS make_user_info_SamBaseInfo(TALLOC_CTX *mem_ctx,
        }
        NT_STATUS_HAVE_NO_MEMORY(info->account_name);
 
-       if (base->domain.string) {
-               info->domain_name = talloc_strdup(info, base->domain.string);
+       if (base->logon_domain.string) {
+               info->domain_name = talloc_strdup(info, base->logon_domain.string);
                NT_STATUS_HAVE_NO_MEMORY(info->domain_name);
        }
 
@@ -227,9 +230,9 @@ NTSTATUS make_user_info_SamBaseInfo(TALLOC_CTX *mem_ctx,
                info->logon_server = talloc_strdup(info, base->logon_server.string);
                NT_STATUS_HAVE_NO_MEMORY(info->logon_server);
        }
-       info->last_logon = base->last_logon;
-       info->last_logoff = base->last_logoff;
-       info->acct_expiry = base->acct_expiry;
+       info->last_logon = base->logon_time;
+       info->last_logoff = base->logoff_time;
+       info->acct_expiry = base->kickoff_time;
        info->last_password_change = base->last_password_change;
        info->allow_password_change = base->allow_password_change;
        info->force_password_change = base->force_password_change;
index 813421eef9ab71c10616c65dd2f92520daba5ed5..24bab8030ded52e3ea0289c02503f1bf713f00c3 100644 (file)
@@ -207,9 +207,9 @@ interface netlogon
        } netr_UserFlags;
 
        typedef struct {
-               NTTIME last_logon;
-               NTTIME last_logoff;
-               NTTIME acct_expiry;
+               NTTIME logon_time;
+               NTTIME logoff_time;
+               NTTIME kickoff_time;
                NTTIME last_password_change;
                NTTIME allow_password_change;
                NTTIME force_password_change;
@@ -227,11 +227,15 @@ interface netlogon
                netr_UserFlags user_flags;
                netr_UserSessionKey key;
                lsa_StringLarge logon_server;
-               lsa_StringLarge domain;
+               lsa_StringLarge logon_domain;
                dom_sid2 *domain_sid;
                netr_LMSessionKey LMSessKey;
                samr_AcctFlags acct_flags;
-               uint32 unknown[7];
+               uint32 sub_auth_status;
+               NTTIME last_successful_logon;
+               NTTIME last_failed_logon;
+               uint32 failed_logon_count;
+               uint32 reserved;
        } netr_SamBaseInfo;
 
        typedef struct {
index 2c26414b27825f5269badfce0fdc15849c3a5c87..fcfed834e523b6457e4d3760b2efd0eef3a59eb7 100644 (file)
@@ -797,7 +797,7 @@ static NTSTATUS get_guest_info3(TALLOC_CTX *mem_ctx,
        if (tmp == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
-       init_lsa_StringLarge(&info3->base.domain, tmp);
+       init_lsa_StringLarge(&info3->base.logon_domain, tmp);
 
        /* Domain sid */
        sid_copy(&domain_sid, get_global_sam_sid());
@@ -1372,7 +1372,7 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
                nt_username = sent_nt_username;
        }
 
-       nt_domain = talloc_strdup(mem_ctx, info3->base.domain.string);
+       nt_domain = talloc_strdup(mem_ctx, info3->base.logon_domain.string);
        if (!nt_domain) {
                /* If the server didn't give us one, just use the one we sent
                 * them */
index 5b2706a28a2e4d15b8ad4e5ef490f2accff5334f..6c2723d699f6882d8e153ed724d51a06978e8bd8 100644 (file)
@@ -384,9 +384,9 @@ NTSTATUS samu_to_SamInfo3(TALLOC_CTX *mem_ctx,
                }
        }
 
-       unix_to_nt_time(&info3->base.last_logon, pdb_get_logon_time(samu));
-       unix_to_nt_time(&info3->base.last_logoff, get_time_t_max());
-       unix_to_nt_time(&info3->base.acct_expiry, get_time_t_max());
+       unix_to_nt_time(&info3->base.logon_time, pdb_get_logon_time(samu));
+       unix_to_nt_time(&info3->base.logoff_time, get_time_t_max());
+       unix_to_nt_time(&info3->base.kickoff_time, get_time_t_max());
        unix_to_nt_time(&info3->base.last_password_change,
                        pdb_get_pass_last_set_time(samu));
        unix_to_nt_time(&info3->base.allow_password_change,
@@ -428,9 +428,9 @@ NTSTATUS samu_to_SamInfo3(TALLOC_CTX *mem_ctx,
        info3->base.logon_count = pdb_get_logon_count(samu);
        info3->base.bad_password_count = pdb_get_bad_password_count(samu);
 
-       info3->base.domain.string = talloc_strdup(info3,
+       info3->base.logon_domain.string = talloc_strdup(info3,
                                                  pdb_get_domain(samu));
-       RET_NOMEM(info3->base.domain.string);
+       RET_NOMEM(info3->base.logon_domain.string);
 
        info3->base.domain_sid = dom_sid_dup(info3, &domain_sid);
        RET_NOMEM(info3->base.domain_sid);
@@ -560,9 +560,9 @@ struct netr_SamInfo3 *wbcAuthUserInfo_to_netr_SamInfo3(TALLOC_CTX *mem_ctx,
        info3 = talloc_zero(mem_ctx, struct netr_SamInfo3);
        if (!info3) return NULL;
 
-       info3->base.last_logon = info->logon_time;
-       info3->base.last_logoff = info->logoff_time;
-       info3->base.acct_expiry = info->kickoff_time;
+       info3->base.logon_time = info->logon_time;
+       info3->base.logoff_time = info->logoff_time;
+       info3->base.kickoff_time = info->kickoff_time;
        unix_to_nt_time(&info3->base.last_password_change, info->pass_last_set_time);
        unix_to_nt_time(&info3->base.allow_password_change,
                        info->pass_can_change_time);
@@ -635,9 +635,9 @@ struct netr_SamInfo3 *wbcAuthUserInfo_to_netr_SamInfo3(TALLOC_CTX *mem_ctx,
                RET_NOMEM(info3->base.logon_server.string);
        }
        if (info->domain_name) {
-               info3->base.domain.string =
+               info3->base.logon_domain.string =
                                talloc_strdup(info3, info->domain_name);
-               RET_NOMEM(info3->base.domain.string);
+               RET_NOMEM(info3->base.logon_domain.string);
        }
 
        info3->base.domain_sid = dom_sid_dup(info3, &domain_sid);
index b106e4597392a074371bb89d64faadbcdedc66d1..f90ef6c158764cb18272c04ec9feb4c2dc52cebe 100644 (file)
@@ -73,9 +73,9 @@ NTSTATUS get_user_from_kerberos_info(TALLOC_CTX *mem_ctx,
                }
        }
 
-       if (logon_info && logon_info->info3.base.domain.string) {
+       if (logon_info && logon_info->info3.base.logon_domain.string) {
                domain = talloc_strdup(mem_ctx,
-                                       logon_info->info3.base.domain.string);
+                                       logon_info->info3.base.logon_domain.string);
                if (!domain) {
                        return NT_STATUS_NO_MEMORY;
                }
@@ -259,7 +259,7 @@ NTSTATUS make_session_info_krb5(TALLOC_CTX *mem_ctx,
                 * %D. */
 
                if (server_info->info3 != NULL) {
-                       server_info->info3->base.domain.string =
+                       server_info->info3->base.logon_domain.string =
                                talloc_strdup(server_info->info3, ntdomain);
                }
        }
index 558a4dae03db21e803565406695e60c6429a4154..d22078be3325a3d74435cc6fc68721e690c93b79 100644 (file)
@@ -52,7 +52,7 @@ NTSTATUS copy_netr_SamBaseInfo(TALLOC_CTX *mem_ctx,
        }
 
        COPY_LSA_STRING(mem_ctx, in, out, logon_server);
-       COPY_LSA_STRING(mem_ctx, in, out, domain);
+       COPY_LSA_STRING(mem_ctx, in, out, logon_domain);
 
        if (in->domain_sid) {
                out->domain_sid = dom_sid_dup(mem_ctx, in->domain_sid);
index 5270b72fbde978c89b7b256778f061cff81bb2c7..89885b9230ef82912a9234ff8f6bf02524b6b3ce 100644 (file)
@@ -111,7 +111,7 @@ static int make_server_pipes_struct(TALLOC_CTX *mem_ctx,
 
                status = make_server_info_info3(p,
                                                info3->base.account_name.string,
-                                               info3->base.domain.string,
+                                               info3->base.logon_domain.string,
                                                &server_info, info3);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(1, ("Failed to init server info\n"));
index 7417bf42cb006ab211d3dce37639cefb2d6a0587..999cb156ed2caeed997f7d1da90e80b718ac1219 100644 (file)
@@ -52,11 +52,11 @@ static NTSTATUS append_info3_as_txt(TALLOC_CTX *mem_ctx,
        uint32_t i;
 
        resp->data.auth.info3.logon_time =
-               nt_time_to_unix(info3->base.last_logon);
+               nt_time_to_unix(info3->base.logon_time);
        resp->data.auth.info3.logoff_time =
-               nt_time_to_unix(info3->base.last_logoff);
+               nt_time_to_unix(info3->base.logoff_time);
        resp->data.auth.info3.kickoff_time =
-               nt_time_to_unix(info3->base.acct_expiry);
+               nt_time_to_unix(info3->base.kickoff_time);
        resp->data.auth.info3.pass_last_set_time =
                nt_time_to_unix(info3->base.last_password_change);
        resp->data.auth.info3.pass_can_change_time =
@@ -93,7 +93,7 @@ static NTSTATUS append_info3_as_txt(TALLOC_CTX *mem_ctx,
        fstrcpy(resp->data.auth.info3.logon_srv,
                info3->base.logon_server.string);
        fstrcpy(resp->data.auth.info3.logon_dom,
-               info3->base.domain.string);
+               info3->base.logon_domain.string);
 
        ex = talloc_strdup(mem_ctx, "");
        NT_STATUS_HAVE_NO_MEMORY(ex);
@@ -156,7 +156,7 @@ static NTSTATUS append_unix_username(TALLOC_CTX *mem_ctx,
 
        const char *nt_username, *nt_domain;
 
-       nt_domain = talloc_strdup(mem_ctx, info3->base.domain.string);
+       nt_domain = talloc_strdup(mem_ctx, info3->base.logon_domain.string);
        if (!nt_domain) {
                /* If the server didn't give us one, just use the one
                 * we sent them */
@@ -895,7 +895,7 @@ static NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain,
                        return NT_STATUS_LOGON_FAILURE;
                }
 
-               kickoff_time = nt_time_to_unix(my_info3->base.acct_expiry);
+               kickoff_time = nt_time_to_unix(my_info3->base.kickoff_time);
                if (kickoff_time != 0 && time(NULL) > kickoff_time) {
                        return NT_STATUS_ACCOUNT_EXPIRED;
                }
@@ -977,7 +977,7 @@ static NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain,
                /* FIXME: we possibly should handle logon hours as well (does xp when
                 * offline?) see auth/auth_sam.c:sam_account_ok for details */
 
-               unix_to_nt_time(&my_info3->base.last_logon, time(NULL));
+               unix_to_nt_time(&my_info3->base.logon_time, time(NULL));
                my_info3->base.bad_password_count = 0;
 
                result = winbindd_update_creds_by_info3(domain,
index 63827ef75508743103783b48156459fcd6991f35..34fe6f870ca32afa9a40ac07383148eb1feb5c96 100644 (file)
@@ -45,9 +45,9 @@ static NTSTATUS get_info3_from_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
        user_sid = (struct dom_sid *)(void *)&info->sids[0].sid;
        group_sid = (struct dom_sid *)(void *)&info->sids[1].sid;
 
-       info3->base.last_logon = info->logon_time;
-       info3->base.last_logoff = info->logoff_time;
-       info3->base.acct_expiry = info->kickoff_time;
+       info3->base.logon_time = info->logon_time;
+       info3->base.logoff_time = info->logoff_time;
+       info3->base.kickoff_time = info->kickoff_time;
        info3->base.last_password_change = info->pass_last_set_time;
        info3->base.allow_password_change = info->pass_can_change_time;
        info3->base.force_password_change = info->pass_must_change_time;
@@ -66,7 +66,7 @@ static NTSTATUS get_info3_from_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
                                                      info->home_drive);
        info3->base.logon_server.string = talloc_strdup(mem_ctx,
                                                        info->logon_server);
-       info3->base.domain.string = talloc_strdup(mem_ctx,
+       info3->base.logon_domain.string = talloc_strdup(mem_ctx,
                                                  info->domain_name);
 
        info3->base.logon_count = info->logon_count;
@@ -77,7 +77,11 @@ static NTSTATUS get_info3_from_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
        memcpy(info3->base.LMSessKey.key, info->lm_session_key,
               sizeof(info3->base.LMSessKey.key));
        info3->base.acct_flags = info->acct_flags;
-       memset(info3->base.unknown, 0, sizeof(info3->base.unknown));
+       info3->base.sub_auth_status = 0;
+       info3->base.last_successful_logon = 0;
+       info3->base.last_failed_logon = 0;
+       info3->base.failed_logon_count = 0;
+       info3->base.reserved = 0;
 
        if (info->num_sids < 2) {
                return NT_STATUS_INVALID_PARAMETER;
index fd1fbbff1f6d4ba1257a8d81df1a0e99c86e1f22..b92eb219852ffcfa59e55e8efbf975cec1466daa 100644 (file)
@@ -684,8 +684,8 @@ static bool samsync_handle_user(struct torture_context *tctx, TALLOC_CTX *mem_ct
                TEST_STRING_EQUAL(user->logon_script, info3->base.logon_script);
 
 
-               TEST_TIME_EQUAL(user->last_logon, info3->base.last_logon);
-               TEST_TIME_EQUAL(user->acct_expiry, info3->base.acct_expiry);
+               TEST_TIME_EQUAL(user->last_logon, info3->base.logon_time);
+               TEST_TIME_EQUAL(user->acct_expiry, info3->base.kickoff_time);
                TEST_TIME_EQUAL(user->last_password_change, info3->base.last_password_change);
                TEST_TIME_EQUAL(info->info21.force_password_change, info3->base.force_password_change);
 
@@ -696,8 +696,8 @@ static bool samsync_handle_user(struct torture_context *tctx, TALLOC_CTX *mem_ct
                /* This copes with the two different versions of 0 I see */
                /* with NT4 sp6 we have the || case */
                if (!((user->last_logoff == 0)
-                     || (info3->base.last_logoff == 0x7fffffffffffffffLL))) {
-                       TEST_TIME_EQUAL(user->last_logoff, info3->base.last_logoff);
+                     || (info3->base.logoff_time == 0x7fffffffffffffffLL))) {
+                       TEST_TIME_EQUAL(user->last_logoff, info3->base.logoff_time);
                }
 
                TEST_INT_EQUAL(rids->count, info3->base.groups.count);
index e09addac73f737e118e6a3868e1da848fcae9e26..bcbc6286b58d75aaa7614912746c09dca9c26e1a 100644 (file)
@@ -170,9 +170,9 @@ static void pam_auth_crap_recv_logon(struct composite_context *ctx)
                state->user_name = base->account_name.string;
                talloc_steal(state, base->account_name.string);
        }
-       if (base->domain.string) {
-               state->domain_name = base->domain.string;
-               talloc_steal(state, base->domain.string);
+       if (base->logon_domain.string) {
+               state->domain_name = base->logon_domain.string;
+               talloc_steal(state, base->logon_domain.string);
        }
 
        state->unix_username = talloc_asprintf(state, "%s%s%s", 
index 679a2a2335cda9af09b27a640d1cd2861275418f..54b1dcc39c7e1b26da7b0217cf5d4d48d5d57eaf 100644 (file)
@@ -61,11 +61,11 @@ static NTSTATUS wb_samba3_append_info3_as_txt(TALLOC_CTX *mem_ctx,
        }
 
        s3call->response->data.auth.info3.logon_time =
-               nt_time_to_unix(info3->base.last_logon);
+               nt_time_to_unix(info3->base.logon_time);
        s3call->response->data.auth.info3.logoff_time =
-               nt_time_to_unix(info3->base.last_logoff);
+               nt_time_to_unix(info3->base.logoff_time);
        s3call->response->data.auth.info3.kickoff_time =
-               nt_time_to_unix(info3->base.acct_expiry);
+               nt_time_to_unix(info3->base.kickoff_time);
        s3call->response->data.auth.info3.pass_last_set_time =
                nt_time_to_unix(info3->base.last_password_change);
        s3call->response->data.auth.info3.pass_can_change_time =
@@ -102,7 +102,7 @@ static NTSTATUS wb_samba3_append_info3_as_txt(TALLOC_CTX *mem_ctx,
        fstrcpy(s3call->response->data.auth.info3.logon_srv,
                info3->base.logon_server.string);
        fstrcpy(s3call->response->data.auth.info3.logon_dom,
-               info3->base.domain.string);
+               info3->base.logon_domain.string);
 
        ex = talloc_strdup(mem_ctx, "");
        NT_STATUS_HAVE_NO_MEMORY(ex);