Univention Bugzilla – Attachment 9153 Details for
Bug 45263
univention_samaccountname_ldap_check should return better error code
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
45263.patch (text/plain), 3.72 KB, created by
Florian Best
on 2017-08-29 13:33:02 CEST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2017-08-29 13:33:02 CEST
Size:
3.72 KB
patch
obsolete
>diff --git a/services/univention-ldb-modules/modules/univention_samaccountname_ldap_check.c b/services/univention-ldb-modules/modules/univention_samaccountname_ldap_check.c >index 209a1e5..f1c66c5 100644 >--- a/services/univention-ldb-modules/modules/univention_samaccountname_ldap_check.c >+++ b/services/univention-ldb-modules/modules/univention_samaccountname_ldap_check.c >@@ -282,15 +282,15 @@ static int univention_samaccountname_ldap_check_add(struct ldb_module *module, s > if( ! WIFEXITED(status) ) { > ldb_debug(ldb, LDB_DEBUG_ERROR, "%s: Cannot determine return status of ucs-school-create_windows_computer: %s (%d)\n", ldb_module_get_name(module), strerror(errno_wait), errno_wait); > return LDB_ERR_UNWILLING_TO_PERFORM; >- } else if( WEXITSTATUS(status) == 1 ) { >- ldb_debug(ldb, LDB_DEBUG_ERROR, "%s: LDB_ERR_ENTRY_ALREADY_EXISTS\n", ldb_module_get_name(module)); >- return LDB_ERR_ENTRY_ALREADY_EXISTS; > } else if( WEXITSTATUS(status) == 2 ) { > ldb_debug(ldb, LDB_DEBUG_ERROR, ("%s: ldb_add of machine object is disabled\n"), ldb_module_get_name(module)); > return LDB_ERR_UNWILLING_TO_PERFORM; > } else if( WEXITSTATUS(status) == 3 ) { > ldb_debug(ldb, LDB_DEBUG_TRACE, ("%s: ldb_add of machine object ignored in dummy mode\n"), ldb_module_get_name(module)); > return LDB_SUCCESS; >+ } else if( WEXITSTATUS(status) == 4 ) { >+ ldb_debug(ldb, LDB_DEBUG_ERROR, "%s: LDB_ERR_ENTRY_ALREADY_EXISTS\n", ldb_module_get_name(module)); >+ return LDB_ERR_ENTRY_ALREADY_EXISTS; > } else if( WEXITSTATUS(status) ) { > ldb_debug(ldb, LDB_DEBUG_ERROR, ("%s: unknown error code from ucs-school-create_windows_computer: %d\n"), ldb_module_get_name(module), WEXITSTATUS(status)); > return LDB_ERR_UNWILLING_TO_PERFORM; >diff --git a/services/univention-ldb-modules/ucs-school-create_windows_computer b/services/univention-ldb-modules/ucs-school-create_windows_computer >index 8bbce98..db058d8 100755 >--- a/services/univention-ldb-modules/ucs-school-create_windows_computer >+++ b/services/univention-ldb-modules/ucs-school-create_windows_computer >@@ -61,6 +61,7 @@ def main(): > options['school'] = SchoolSearchBase.getOU(ucr.get('ldap/hostdn', '')) or SchoolSearchBase.getOU(ucr.get('dhcpd/ldap/base', '')) > client = Client(args.server, args.username, args.password) > result = client.umc_command(args.command, options).result >+ existed = result.get('existed') > dn_ol = result.get('dn') > if not dn_ol: > # sys.exit(1) >@@ -71,6 +72,8 @@ def main(): > > dn_s4 = dn_ol[:len(dn_ol) - len(ldap_base)] + samba4_ldap_base > print dn_s4 >+ if existed: >+ sys.exit(4) > > > if __name__ == '__main__': >diff --git a/univention-management-console-module-selective-udm/umc/python/selective-udm/__init__.py b/univention-management-console-module-selective-udm/umc/python/selective-udm/__init__.py >index d92500e..cdf928d 100644 >--- a/univention-management-console-module-selective-udm/umc/python/selective-udm/__init__.py >+++ b/univention-management-console-module-selective-udm/umc/python/selective-udm/__init__.py >@@ -40,6 +40,7 @@ > import univention.admin.modules > import univention.admin.objects > import univention.admin.uldap >+import univention.admin.uexceptions > import univention.admin.handlers.users.user > import univention.admin.handlers.computers.windows > >@@ -121,5 +122,10 @@ def create_windows_computer(self, request, ldap_user_read=None, ldap_admin_write > computer['password'] = password > > computer['description'] = request.options.get('description') >- computer_dn = computer.create() >- self.finished(request.id, {'dn': computer_dn}) >+ try: >+ computer_dn = computer.create() >+ existed = False >+ except univention.admin.uexceptions.objectExists as exc: >+ existed = True >+ computer_dn = exc.args[0] >+ self.finished(request.id, {'dn': computer_dn, 'existed': existed})
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 45263
: 9153