diff options
author | Gerald Carter <jerry@samba.org> | 2002-10-01 18:26:00 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2002-10-01 18:26:00 +0000 |
commit | 3de09e5cf1f667e410ee8b9516a956860ce7290f (patch) | |
tree | 23ef9ca994deaf73928b6f015d8bffdbd4c80318 /source/libads/krb5_setpw.c | |
parent | c0ca286e36d49deba6c73690114b0d867cbfd63e (diff) | |
download | samba-3de09e5cf1f667e410ee8b9516a956860ce7290f.tar.gz samba-3de09e5cf1f667e410ee8b9516a956860ce7290f.tar.xz samba-3de09e5cf1f667e410ee8b9516a956860ce7290f.zip |
syncing up with HEAD. Seems to be a lot of differences creeping in
(i ignored the new SAMBA stuff, but the rest of this looks like it should
have been merged already).
Diffstat (limited to 'source/libads/krb5_setpw.c')
-rw-r--r-- | source/libads/krb5_setpw.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source/libads/krb5_setpw.c b/source/libads/krb5_setpw.c index a49b6cbe3b0..8079c0953fc 100644 --- a/source/libads/krb5_setpw.c +++ b/source/libads/krb5_setpw.c @@ -471,4 +471,35 @@ ADS_STATUS kerberos_set_password(const char *kpasswd_server, } +/** + * Set the machine account password + * @param ads connection to ads server + * @param hostname machine whose password is being set + * @param password new password + * @return status of password change + **/ +ADS_STATUS ads_set_machine_password(ADS_STRUCT *ads, + const char *hostname, + const char *password) +{ + ADS_STATUS status; + char *host = strdup(hostname); + char *principal; + + strlower(host); + + /* + we need to use the '$' form of the name here, as otherwise the + server might end up setting the password for a user instead + */ + asprintf(&principal, "%s$@%s", host, ads->auth.realm); + + status = krb5_set_password(ads->auth.kdc_server, principal, password, ads->auth.time_offset); + + free(host); + free(principal); + + return status; +} + #endif |