summaryrefslogtreecommitdiffstats
path: root/repo
diff options
context:
space:
mode:
authorXiaodong Xu <stid.smth@gmail.com>2012-01-31 11:10:09 +0800
committerShawn O. Pearce <sop@google.com>2012-03-14 15:01:34 -0700
commitae0a36c9a59e7f872578b17b3b7fa8f72df3cb59 (patch)
tree2cfb4182ad08064d001463aa5aa9079ab638f78a /repo
parent76abcc1d1ea2da6cf0ce381486e2f9bf4ca55c36 (diff)
downloadgit-repo-ae0a36c9a59e7f872578b17b3b7fa8f72df3cb59.tar.gz
Add support for Apache Digest authentication for repo init.
repo tool supports only Basic authentication for now. For those who want to use this tool to manage their own projects, in case the administrator has configured the Apache server with Digest authentication method, users will fail to be authenticated when they run the command 'repo init'. Add the digest authentication password manager to the handler list will fix this issue. Since Git HTTP protocol will require the user be authenticated for fetch operation first before pushing commits to the remote, it is unlikely for the administrator to implement anonymous read (aka pull) access and write access (aka push) for authenticated user. Both read and write have to be authenticated. Be aware that the user may have to add an extra line in his ~/.netrc file: ------------------- account example.com ------------------- where 'example.com' is the realm for Apache Digest authentication. Change-Id: I76eb27b205554426d9ce1965deaaf727b87916cd Signed-off-by: Xiaodong Xu <stid.smth@gmail.com>
Diffstat (limited to 'repo')
-rwxr-xr-xrepo9
1 files changed, 5 insertions, 4 deletions
diff --git a/repo b/repo
index 2a13af5b..1977d635 100755
--- a/repo
+++ b/repo
@@ -28,7 +28,7 @@ if __name__ == '__main__':
28del magic 28del magic
29 29
30# increment this whenever we make important changes to this script 30# increment this whenever we make important changes to this script
31VERSION = (1, 13) 31VERSION = (1, 14)
32 32
33# increment this if the MAINTAINER_KEYS block is modified 33# increment this if the MAINTAINER_KEYS block is modified
34KEYRING_VERSION = (1,0) 34KEYRING_VERSION = (1,0)
@@ -154,7 +154,7 @@ def _Init(args):
154 """Installs repo by cloning it over the network. 154 """Installs repo by cloning it over the network.
155 """ 155 """
156 opt, args = init_optparse.parse_args(args) 156 opt, args = init_optparse.parse_args(args)
157 if args or not opt.manifest_url: 157 if args:
158 init_optparse.print_usage() 158 init_optparse.print_usage()
159 sys.exit(1) 159 sys.exit(1)
160 160
@@ -311,11 +311,12 @@ def _InitHttp():
311 n = netrc.netrc() 311 n = netrc.netrc()
312 for host in n.hosts: 312 for host in n.hosts:
313 p = n.hosts[host] 313 p = n.hosts[host]
314 mgr.add_password(None, 'http://%s/' % host, p[0], p[2]) 314 mgr.add_password(p[1], 'http://%s/' % host, p[0], p[2])
315 mgr.add_password(None, 'https://%s/' % host, p[0], p[2]) 315 mgr.add_password(p[1], 'https://%s/' % host, p[0], p[2])
316 except: 316 except:
317 pass 317 pass
318 handlers.append(urllib2.HTTPBasicAuthHandler(mgr)) 318 handlers.append(urllib2.HTTPBasicAuthHandler(mgr))
319 handlers.append(urllib2.HTTPDigestAuthHandler(mgr))
319 320
320 if 'http_proxy' in os.environ: 321 if 'http_proxy' in os.environ:
321 url = os.environ['http_proxy'] 322 url = os.environ['http_proxy']