Univention Bugzilla – Attachment 10949 Details for
Bug 51996
Migration univention-appcenter-control script to Python 3
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Replace UMC Auth with HTTP basic auth
univention-appcenter-control-basic.patch (text/plain), 2.35 KB, created by
Florian Best
on 2022-05-09 21:36:20 CEST
(
hide
)
Description:
Replace UMC Auth with HTTP basic auth
Filename:
MIME Type:
Creator:
Florian Best
Created:
2022-05-09 21:36:20 CEST
Size:
2.35 KB
patch
obsolete
>--- univention-appcenter-control.new 2022-05-09 21:29:11.019970049 +0200 >+++ univention-appcenter-control 2022-05-09 21:33:38.608857497 +0200 >@@ -310,7 +310,8 @@ > > def __init__(self): > super(SelfserviceAction, self).__init__() >- self._cookiejar = None >+ self._username = None >+ self._password = None > > def setup_parser(self, parser): > try: >@@ -336,11 +337,8 @@ > raise Abort('Unrecoverable result: %r' % result) > > def _login(self, args): >- username = self._get_username(args) >- password = self._get_password(args) >- self._cookiejar = NamedTemporaryFile() >- result = self.curl(args, 'auth', username=username, password=password) >- self._get_result(result) >+ self._username = self._get_username(args) >+ self._password = self._get_password(args) > result = self.command(args, 'api') > remote_api_level = self._get_result(result) > if remote_api_level != self.API_LEVEL: >@@ -368,17 +366,8 @@ > if not args: > args.extend(['-X', 'POST']) > args.extend(['-H', 'Content-Length: 0']) >- umc_session_id = None >- with open(self._cookiejar.name) as cookie_file: >- # hopefully, cookie jar format does not change with different libcurl versions... >- for line in cookie_file: >- match = re.match(r'(.*)\t(.*)\t(.*)\t(.*)\t(.*)\tUMCSessionId\t(.*)', line) >- if match: >- umc_session_id = match.groups()[-1] >- if umc_session_id: >- args.extend(['-H', 'X-Xsrf-Protection: %s' % umc_session_id]) > >- args = ['curl', '--cookie', self._cookiejar.name, '--cookie-jar', self._cookiejar.name, '-H', 'X-Requested-With: XmlHttpRequest', '-H', 'Accept: application/json; q=1'] + args + [uri] >+ args = ['curl', '--basic', '--user', '%s:%s' % (self._username, self._password), '-H', 'X-Requested-With: XmlHttpRequest', '-H', 'Accept: application/json; q=1'] + args + [uri] > process = Popen(args, stdout=PIPE, stderr=PIPE) > out, err = process.communicate() > out, err = out.decode('UTF-8'), err.decode('UTF-8') >@@ -390,12 +379,12 @@ > raise Abort('Unrecoverable Response') > > def command(self, args, command, **kwargs): >- if not self._cookiejar: >+ if not self._username: > self._login(args) > return self.curl(args, 'command/appcenter-selfservice/%s' % command, _command=True, **kwargs) > > def upload(self, args, **kwargs): >- if not self._cookiejar: >+ if not self._username: > self._login(args) > return self.curl(args, 'upload/appcenter-selfservice/upload', **kwargs) >
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 51996
:
10487
|
10947
|
10948
| 10949