{
Ggit.Cred? ret = null;
GLib.debug("get credentials %s UN=%s", url, username_from_url);
-
- return new Ggit.CredPlaintext(username_from_url, "test");
+ var uri = new Soup.URI(url);
+ this.netrc(uri.get_host)
+ if (uri != null) {
+ var ret = this.netrc(uri.get_host())
+ //return new Ggit.CredPlaintext(username_from_url, "test");
+ }
/*var provider = d_remote.credentials_provider;
if (provider != null)
}
}
+ public Ggit.Cred netrc(string domain)
+ {
+ string str;
+ GLib.FileUtils.get_contents(GLib.Environment.get_home_dir() + "/.netrc", out str);
+ var lines = str.split("\n");
+ for(var i=0; i< lines.length; i++) {
+ // assumes one line per entry.. if not we are buggered...
+ GLib.debug("got %s" , lines[i]);
+
+ var bits = Regex.split_simple ("[ \t]+", lines[i].strip());
+ if (bits.length < 6 || bits[0] != "machine" || bits[1] != domain) {
+ continue;
+ }
+ GLib.debug("found password?");
+ // we are gussing....
+ return new Ggit.CredPlaintext(bits[3], bits[5]);
+
+ }
+ return null;
+
+
+
+ }
}
\ No newline at end of file