codekingpro/portable-devtools
114k
1"""
2"""
3
4# Created on 2014.04.28
5#
6# Author: Giovanni Cannata
7#
8# Copyright 2014 - 2020 Giovanni Cannata
9#
10# This file is part of ldap3.
11#
12# ldap3 is free software: you can redistribute it and/or modify
13# it under the terms of the GNU Lesser General Public License as published
14# by the Free Software Foundation, either version 3 of the License, or
15# (at your option) any later version.
16#
17# ldap3 is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU Lesser General Public License for more details.
21#
22# You should have received a copy of the GNU Lesser General Public License
23# along with ldap3 in the COPYING and COPYING.LESSER files.
24# If not, see <http://www.gnu.org/licenses/>.
25
26from pyasn1.type.univ import OctetString, Sequence
27from pyasn1.type.namedtype import NamedTypes, OptionalNamedType
28from pyasn1.type.tag import Tag, tagClassContext, tagFormatSimple
29
30# Modify password extended operation
31# passwdModifyOID OBJECT IDENTIFIER ::= 1.3.6.1.4.1.4203.1.11.1
32# PasswdModifyRequestValue ::= SEQUENCE {
33# userIdentity [0] OCTET STRING OPTIONAL
34# oldPasswd [1] OCTET STRING OPTIONAL
35# newPasswd [2] OCTET STRING OPTIONAL }
36#
37# PasswdModifyResponseValue ::= SEQUENCE {
38# genPasswd [0] OCTET STRING OPTIONAL }
39
40
41class UserIdentity(OctetString):
42 """
43 userIdentity [0] OCTET STRING OPTIONAL
44 """
45 tagSet = OctetString.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 0))
46 encoding = 'utf-8'
47
48
49class OldPasswd(OctetString):
50 """
51 oldPasswd [1] OCTET STRING OPTIONAL
52 """
53 tagSet = OctetString.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 1))
54 encoding = 'utf-8'
55
56
57class NewPasswd(OctetString):
58 """
59 newPasswd [2] OCTET STRING OPTIONAL
60 """
61 tagSet = OctetString.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 2))
62 encoding = 'utf-8'
63
64
65class GenPasswd(OctetString):
66 """
67 newPasswd [2] OCTET STRING OPTIONAL
68 """
69 tagSet = OctetString.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 0))
70 encoding = 'utf-8'
71
72
73class PasswdModifyRequestValue(Sequence):
74 """
75 PasswdModifyRequestValue ::= SEQUENCE {
76 userIdentity [0] OCTET STRING OPTIONAL
77 oldPasswd [1] OCTET STRING OPTIONAL
78 newPasswd [2] OCTET STRING OPTIONAL }
79 """
80 componentType = NamedTypes(OptionalNamedType('userIdentity', UserIdentity()),
81 OptionalNamedType('oldPasswd', OldPasswd()),
82 OptionalNamedType('newPasswd', NewPasswd()))
83
84
85class PasswdModifyResponseValue(Sequence):
86 """
87 PasswdModifyResponseValue ::= SEQUENCE {
88 genPasswd [0] OCTET STRING OPTIONAL }
89 """
90
91 componentType = NamedTypes(OptionalNamedType('genPasswd', GenPasswd()))
92 