libwbclient: add wbcChangeTrustCredentials.
authorGünther Deschner <gd@samba.org>
Tue, 6 Oct 2009 16:15:08 +0000 (18:15 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 13 Oct 2009 10:42:44 +0000 (12:42 +0200)
Guenther

nsswitch/libwbclient/wbc_pam.c
nsswitch/libwbclient/wbclient.h
nsswitch/winbind_struct_protocol.h

index 4cd212a34aefd09e4696bce7c587f3e3c73bafb8..7a66a7fe82675c538bd058981b1b5c1875bfb49d 100644 (file)
@@ -532,6 +532,44 @@ wbcErr wbcCheckTrustCredentials(const char *domain,
        return wbc_status;
 }
 
        return wbc_status;
 }
 
+/* Trigger a change of the trust credentials for a specific domain */
+wbcErr wbcChangeTrustCredentials(const char *domain,
+                                struct wbcAuthErrorInfo **error)
+{
+       struct winbindd_request request;
+       struct winbindd_response response;
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       if (domain) {
+               strncpy(request.domain_name, domain,
+                       sizeof(request.domain_name)-1);
+       }
+
+       /* Send request */
+
+       wbc_status = wbcRequestResponse(WINBINDD_CHANGE_MACHACC,
+                                       &request,
+                                       &response);
+       if (response.data.auth.nt_status != 0) {
+               if (error) {
+                       wbc_status = wbc_create_error_info(NULL,
+                                                          &response,
+                                                          error);
+                       BAIL_ON_WBC_ERROR(wbc_status);
+               }
+
+               wbc_status = WBC_ERR_AUTH_ERROR;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+ done:
+       return wbc_status;
+}
+
 /* Trigger an extended logoff notification to Winbind for a specific user */
 wbcErr wbcLogoffUserEx(const struct wbcLogoffUserParams *params,
                       struct wbcAuthErrorInfo **error)
 /* Trigger an extended logoff notification to Winbind for a specific user */
 wbcErr wbcLogoffUserEx(const struct wbcLogoffUserParams *params,
                       struct wbcAuthErrorInfo **error)
index e262679264484d2e3689ee2b78ccbea646b9ee44..0c0c4949250c17d5f2d40d94c712b82a2b13421f 100644 (file)
@@ -1202,6 +1202,17 @@ wbcErr wbcResolveWinsByIP(const char *ip, char **name);
 wbcErr wbcCheckTrustCredentials(const char *domain,
                                struct wbcAuthErrorInfo **error);
 
 wbcErr wbcCheckTrustCredentials(const char *domain,
                                struct wbcAuthErrorInfo **error);
 
+/**
+ * @brief Trigger a change of the trust credentials for a specific domain
+ *
+ * @param *domain      The name of the domain.
+ * @param error        Output details on WBC_ERR_AUTH_ERROR
+ *
+ * @return #wbcErr
+ **/
+wbcErr wbcChangeTrustCredentials(const char *domain,
+                                struct wbcAuthErrorInfo **error);
+
 /**********************************************************
  * Helper functions
  **********************************************************/
 /**********************************************************
  * Helper functions
  **********************************************************/
index bd144101f2449a5c6c345c4928ff8ce41df77dff..3056e25905e49bc1a0abb35072e9343a31775a7a 100644 (file)
@@ -118,6 +118,7 @@ enum winbindd_cmd {
        /* Miscellaneous other stuff */
 
        WINBINDD_CHECK_MACHACC,     /* Check machine account pw works */
        /* Miscellaneous other stuff */
 
        WINBINDD_CHECK_MACHACC,     /* Check machine account pw works */
+       WINBINDD_CHANGE_MACHACC,    /* Change machine account pw */
        WINBINDD_PING,              /* Just tell me winbind is running */
        WINBINDD_INFO,              /* Various bit of info.  Currently just tidbits */
        WINBINDD_DOMAIN_NAME,       /* The domain this winbind server is a member of (lp_workgroup()) */
        WINBINDD_PING,              /* Just tell me winbind is running */
        WINBINDD_INFO,              /* Various bit of info.  Currently just tidbits */
        WINBINDD_DOMAIN_NAME,       /* The domain this winbind server is a member of (lp_workgroup()) */