| 1 |
#!/usr/bin/env python3 |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
# |
| 4 |
# Unix SMB/CIFS implementation. |
| 5 |
# Copyright (C) Kamen Mazdrashki <[email protected]> 2009 |
| 6 |
# |
| 7 |
# This program is free software; you can redistribute it and/or modify |
| 8 |
# it under the terms of the GNU General Public License as published by |
| 9 |
# the Free Software Foundation; either version 3 of the License, or |
| 10 |
# (at your option) any later version. |
| 11 |
# |
| 12 |
# This program is distributed in the hope that it will be useful, |
| 13 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
# GNU General Public License for more details. |
| 16 |
# |
| 17 |
# You should have received a copy of the GNU General Public License |
| 18 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
# |
| 20 |
|
| 21 |
# |
| 22 |
# Usage: |
| 23 |
# export ACCOUNT_NAME=kamen |
| 24 |
# export NEW_PASS=test |
| 25 |
# export SUBUNITRUN=$samba4srcdir/scripting/bin/subunitrun |
| 26 |
# PYTHONPATH="$samba4srcdir/torture/libnet/python" $SUBUNITRUN samr-test -Ukma-exch.devel/Administrator%333 |
| 27 |
# |
| 28 |
|
| 29 |
import os |
| 30 |
|
| 31 |
from samba import net |
| 32 |
import samba.tests |
| 33 |
|
| 34 |
if "ACCOUNT_NAME" not in os.environ.keys(): |
| 35 |
raise Exception("Please supply ACCOUNT_NAME in environment") |
| 36 |
|
| 37 |
if "NEW_PASS" not in os.environ.keys(): |
| 38 |
raise Exception("Please supply NEW_PASS in environment") |
| 39 |
|
| 40 |
account_name = os.environ["ACCOUNT_NAME"] |
| 41 |
new_pass = os.environ["NEW_PASS"] |
| 42 |
|
| 43 |
# |
| 44 |
# Tests start here |
| 45 |
# |
| 46 |
|
| 47 |
|
| 48 |
class Libnet_SetPwdTest(samba.tests.TestCase): |
| 49 |
|
| 50 |
######################################################################################## |
| 51 |
|
| 52 |
def test_SetPassword(self): |
| 53 |
creds = self.get_credentials() |
| 54 |
net.SetPassword(account_name=account_name, |
| 55 |
domain_name=creds.get_domain(), |
| 56 |
newpassword=new_pass, |
| 57 |
credentials=creds) |
| 58 |
|
| 59 |
######################################################################################## |