| 121 | self.__attributes = attributes |
| 122 | |
| 123 | def serialize(self) -> bytes: |
| 124 | s = Serializer() |
| 125 | s.push_size(2) |
| 126 | for k, v in reversed(self.__attributes.items()): |
| 127 | s.push_size(3).push(v.encode()).pop_size().push(b"\x04").pop_size().push(b"1") |
| 128 | s.push_size().push(k.encode()).pop_size().push(b"\x04").pop_size().push(b"0") |
| 129 | |
| 130 | s.push(b"0\x81\x82") |
| 131 | s.push_size().push(self.__query_name.encode()).pop_size().push(b"\x04").pop_size() |
| 132 | s.push(b"\x02\x01\x02d\x81").pop_size().push(b"0\x81") |
| 133 | |
| 134 | SUCCESS_RESPONSE = b"0\x0c\x02\x01\x02e\x07\n\x01\x00\x04\x00\x04\x00" |
| 135 | return s.build() + SUCCESS_RESPONSE |
| 136 | |
| 137 | class LDAPHandler(socketserver.BaseRequestHandler): |
| 138 | """ |