<div>Hello guys,</div><div><br></div><div>I made a little patch in opkg to authentication in repositories that using passwords in the directories. The patch working when use libcurl or wget to donwload.</div><div><br></div>
<div>Diff:</div><div><br></div><div><div>Index: libopkg/opkg_conf.c</div><div>===================================================================</div><div>--- libopkg/opkg_conf.c (revision 518)</div><div>+++ libopkg/opkg_conf.c (working copy)</div>
<div>@@ -64,6 +64,8 @@</div><div> { "offline_root", OPKG_OPT_TYPE_STRING, &_conf.offline_root },</div><div> { "proxy_passwd", OPKG_OPT_TYPE_STRING, &_conf.proxy_passwd },</div><div> { "proxy_user", OPKG_OPT_TYPE_STRING, &_conf.proxy_user },</div>
<div>+ { "http_user", OPKG_OPT_TYPE_STRING, &_conf.http_user },</div><div>+ { "http_passwd", OPKG_OPT_TYPE_STRING, &_conf.http_passwd },</div><div> { "query-all", OPKG_OPT_TYPE_BOOL, &_conf.query_all },</div>
<div> { "tmp_dir", OPKG_OPT_TYPE_STRING, &_conf.tmp_dir },</div><div> { "verbosity", OPKG_OPT_TYPE_INT, &_conf.verbosity },</div><div>Index: libopkg/opkg_conf.h</div><div>===================================================================</div>
<div>--- libopkg/opkg_conf.h (revision 518)</div><div>+++ libopkg/opkg_conf.h (working copy)</div><div>@@ -108,6 +108,10 @@</div><div> char *proxy_user;</div><div> char *proxy_passwd;</div><div><br></div><div>+ /* http auth */</div>
<div>+ char *http_user;</div><div>+ char *http_passwd;</div><div>+</div><div> char *signature_ca_file;</div><div> char *signature_ca_path;</div><div><br></div><div>Index: libopkg/opkg_download.c</div><div>
===================================================================</div><div>--- libopkg/opkg_download.c (revision 518)</div><div>+++ libopkg/opkg_download.c (working copy)</div><div>@@ -156,7 +156,7 @@</div><div> #else</div>
<div> {</div><div> int res;</div><div>- const char *argv[8];</div><div>+ const char *argv[10];</div><div> int i = 0;</div><div><br></div><div> argv[i++] = "wget";</div><div>@@ -165,6 +165,14 @@</div>
<div> argv[i++] = "-Y";</div><div> argv[i++] = "on";</div><div> }</div><div>+</div><div>+ if (conf->http_user && conf->http_passwd) {</div><div>+ char *str;</div>
<div>+ sprintf_alloc(&str, "--http-user=%s", conf->http_user);</div><div>+ argv[i++] = str;</div><div>+ sprintf_alloc(&str, "--http-password=%s", conf->http_passwd);</div>
<div>+ argv[i++] = str;</div><div>+ }</div><div> argv[i++] = "-O";</div><div><div> argv[i++] = tmp_file_location;</div><div> argv[i++] = src;</div><div>@@ -648,6 +656,14 @@</div><div>
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, userpwd);</div><div> free (userpwd);</div><div> }</div><div>+ if (conf->http_user && conf->http_passwd)</div><div>+ {</div><div>+ char *userpwd;</div>
<div>+ sprintf_alloc (&userpwd, "%s:%s", conf->http_user,</div><div>+ conf->http_passwd);</div><div>+ curl_easy_setopt(curl, CURLOPT_USERPWD, userpwd);</div><div>+ free (userpwd);</div>
<div>+ }</div><div> }</div><div><br></div><div> curl_easy_setopt (curl, CURLOPT_NOPROGRESS, (cb == NULL));</div><div><br></div></div></div><div><br></div><div>#example opkg.conf</div><div>option http_user XXX</div>
<div>option http_passwd XXX</div><div><br></div><div>Best regards.</div><br>-- <br>Cleiber Marques da Silva<br>MSc Student in Automation and System Engineering - UFSC<br>E3C Tecnologia<br>cleiber at <a href="http://e3c.com.br">e3c.com.br</a><br>
<br>Phone: +55 48 30240790<br>