Fixed last places where resolv.conf was still expected under /etc, UserGuide included. Fixed authentication misspelling
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35898 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
<table summary="quickinfo" border="0" cellspacing="0" cellpadding="2">
|
||||
<tr><td>Deskbar:</td><td style="width:15px;"></td><td><span class="menu">Preferences</span></td></tr>
|
||||
<tr><td>Ort:</td><td></td><td><span class="path">/boot/system/preferences/Network</span></td></tr>
|
||||
<tr><td>Einstellungen:</td><td></td><td><span class="path">/boot/system/etc/resolv.conf</span></td></tr>
|
||||
<tr><td>Einstellungen:</td><td></td><td><span class="path">/boot/common/settings/network/resolv.conf</span></td></tr>
|
||||
</table>
|
||||
<p><br /></p>
|
||||
<img src="../images/prefs-images/network.png" alt="network.png" />
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<table summary="quickinfo" border="0" cellspacing="0" cellpadding="2">
|
||||
<tr><td>Deskbar:</td><td style="width:15px;"></td><td><span class="menu">Preferences</span></td></tr>
|
||||
<tr><td>Location:</td><td></td><td><span class="path">/boot/system/preferences/Network</span></td></tr>
|
||||
<tr><td>Settings:</td><td></td><td><span class="path">/boot/system/etc/resolv.conf</span></td></tr>
|
||||
<tr><td>Settings:</td><td></td><td><span class="path">/boot/common/settings/network/resolv.conf</span></td></tr>
|
||||
</table>
|
||||
<p><br /></p>
|
||||
<img src="../images/prefs-images/network.png" alt="network.png" />
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<table summary="quickinfo" border="0" cellspacing="0" cellpadding="2">
|
||||
<tr><td>Deskbar:</td><td style="width:15px;"></td><td><span class="menu">Preferencias</span></td></tr>
|
||||
<tr><td>Ubicación:</td><td></td><td><span class="path">/boot/system/preferences/Network</span></td></tr>
|
||||
<tr><td>Configuración:</td><td></td><td><span class="path">/boot/system/etc/resolv.conf</span></td></tr>
|
||||
<tr><td>Configuración:</td><td></td><td><span class="path">/boot/common/settings/network/resolv.conf</span></td></tr>
|
||||
</table>
|
||||
<p><br /></p>
|
||||
<img src="../images/prefs-images/network.png" alt="network.png" />
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<table summary="quickinfo" border="0" cellspacing="0" cellpadding="2">
|
||||
<tr><td>Deskbar :</td><td style="width:15px;"></td><td><span class="menu">Preferences</span></td></tr>
|
||||
<tr><td>Localisation :</td><td></td><td><span class="path">/boot/system/preferences/Network</span></td></tr>
|
||||
<tr><td>Réglages :</td><td></td><td><span class="path">/boot/system/etc/resolv.conf</span></td></tr>
|
||||
<tr><td>Réglages :</td><td></td><td><span class="path">/boot/common/settings/network/resolv.conf</span></td></tr>
|
||||
</table>
|
||||
<p><br /></p>
|
||||
<img src="../images/prefs-images/network.png" alt="network.png" />
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<table summary="quickinfo" border="0" cellspacing="0" cellpadding="2">
|
||||
<tr><td>Deskbar:</td><td style="width:15px;"></td><td><span class="menu">Preferences</span></td></tr>
|
||||
<tr><td>Posizione:</td><td></td><td><span class="path">/boot/system/preferences/Network</span></td></tr>
|
||||
<tr><td>Impostazioni:</td><td></td><td><span class="path">/boot/system/etc/resolv.conf</span></td></tr>
|
||||
<tr><td>Impostazioni:</td><td></td><td><span class="path">/boot/common/settings/network/resolv.conf</span></td></tr>
|
||||
</table>
|
||||
<p><br /></p>
|
||||
<img src="../images/prefs-images/network.png" alt="network.png" />
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<table summary="quickinfo" border="0" cellspacing="0" cellpadding="2">
|
||||
<tr><td>Deskbar:</td><td style="width:15px;"></td><td><span class="menu">Preferences</span></td></tr>
|
||||
<tr><td>Location:</td><td></td><td><span class="path">/boot/system/preferences/Network</span></td></tr>
|
||||
<tr><td>Settings:</td><td></td><td><span class="path">/boot/system/etc/resolv.conf</span></td></tr>
|
||||
<tr><td>Settings:</td><td></td><td><span class="path">/boot/common/settings/network/resolv.conf</span></td></tr>
|
||||
</table>
|
||||
<p><br /></p>
|
||||
<img src="../images/prefs-images/network.png" alt="network.png" />
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<table summary="quickinfo" border="0" cellspacing="0" cellpadding="2">
|
||||
<tr><td>Расположение в Deskbar:</td><td style="width:15px;"></td><td><span class="menu">Настройки (Preferences)</span></td></tr>
|
||||
<tr><td>Расположение в Tracker:</td><td></td><td><span class="path">/boot/system/preferences/Network</span></td></tr>
|
||||
<tr><td>Настройки хранятся по адресу:</td><td></td><td><span class="path">/boot/system/etc/resolv.conf</span></td></tr>
|
||||
<tr><td>Настройки хранятся по адресу:</td><td></td><td><span class="path">/boot/common/settings/network/resolv.conf</span></td></tr>
|
||||
</table>
|
||||
<p><br /></p>
|
||||
<img src="../images/prefs-images/network.png" alt="network.png" />
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<table summary="quickinfo" border="0" cellspacing="0" cellpadding="2">
|
||||
<tr><td>Deskbar:</td><td style="width:15px;"></td><td><span class="menu">Preferences</span></td></tr>
|
||||
<tr><td>Plats:</td><td></td><td><span class="path">/boot/system/preferences/Network</span></td></tr>
|
||||
<tr><td>Inställningar:</td><td></td><td><span class="path">/boot/system/etc/resolv.conf</span></td></tr>
|
||||
<tr><td>Inställningar:</td><td></td><td><span class="path">/boot/common/settings/network/resolv.conf</span></td></tr>
|
||||
</table>
|
||||
<p><br /></p>
|
||||
<img src="../images/prefs-images/network.png" alt="network.png" />
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#define ATTR_NAME_POPSERVER "POP Server"
|
||||
#define ATTR_NAME_IMAPSERVER "IMAP Server"
|
||||
#define ATTR_NAME_SMTPSERVER "SMTP Server"
|
||||
#define ATTR_NAME_AUTHPOP "POP Authentification"
|
||||
#define ATTR_NAME_AUTHSMTP "SMTP Authentification"
|
||||
#define ATTR_NAME_AUTHPOP "POP Authentication"
|
||||
#define ATTR_NAME_AUTHSMTP "SMTP Authentication"
|
||||
#define ATTR_NAME_POPSSL "POP SSL"
|
||||
#define ATTR_NAME_IMAPSSL "IMAP SSL"
|
||||
#define ATTR_NAME_SMTPSSL "SMTP SSL"
|
||||
@@ -78,4 +78,4 @@ class AutoConfig
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#include "DNSQuery.h"
|
||||
|
||||
#include <ByteOrder.h>
|
||||
#include <NetAddress.h>
|
||||
#include <NetEndpoint.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ByteOrder.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <NetAddress.h>
|
||||
#include <NetEndpoint.h>
|
||||
#include <Path.h>
|
||||
|
||||
// #define DEBUG 1
|
||||
|
||||
#undef PRINT
|
||||
@@ -155,11 +157,16 @@ DNSTools::GetDNSServers(BObjectList<BString>* serverList)
|
||||
(line[sizeof(name) - 1] == ' ' || \
|
||||
line[sizeof(name) - 1] == '\t'))
|
||||
|
||||
BPath path;
|
||||
if (find_directory(B_COMMON_SETTINGS_DIRECTORY, &path) != B_OK)
|
||||
return;
|
||||
|
||||
register FILE* fp = fopen("/etc/resolv.conf", "r");
|
||||
path.Append("network/resolv.conf");
|
||||
|
||||
register FILE* fp = fopen(path.Path(), "r");
|
||||
if (fp == NULL) {
|
||||
fprintf(stderr, "failed to open '/etc/resolv.conf' to "
|
||||
"read nameservers: %s\n", strerror(errno));
|
||||
fprintf(stderr, "failed to open '%s' to read nameservers: %s\n",
|
||||
path.Path(), strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -388,7 +388,7 @@ EthernetSettingsView::_SaveDNSConfiguration()
|
||||
|
||||
BFile file(path.Path(), B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY);
|
||||
if (file.InitCheck() != B_OK) {
|
||||
fprintf(stderr, "failed to open /etc/resolv.conf for writing: %s\n",
|
||||
fprintf(stderr, "failed to open %s for writing: %s\n", path.Path(),
|
||||
strerror(file.InitCheck()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -276,10 +276,15 @@ EthernetSettingsView::_SaveConfiguration()
|
||||
void
|
||||
EthernetSettingsView::_SaveDNSConfiguration()
|
||||
{
|
||||
BFile file("/etc/resolv.conf",
|
||||
B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY);
|
||||
if (file.InitCheck() < B_OK) {
|
||||
fprintf(stderr, "failed to open /etc/resolv.conf for writing: %s\n",
|
||||
BPath path;
|
||||
if (find_directory(B_COMMON_SETTINGS_DIRECTORY, &path) != B_OK)
|
||||
return;
|
||||
|
||||
path.Append("network/resolv.conf");
|
||||
|
||||
BFile file(path.Path(), B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY);
|
||||
if (file.InitCheck() != B_OK) {
|
||||
fprintf(stderr, "failed to open %s for writing: %s\n", path.Path(),
|
||||
strerror(file.InitCheck()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5,37 +5,40 @@
|
||||
* Author:
|
||||
* Andre Alves Garzia, andre@andregarzia.com
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "Setting.h"
|
||||
|
||||
#include <String.h>
|
||||
#include <File.h>
|
||||
#include <Path.h>
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <AutoDeleter.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_media.h>
|
||||
#include <net/if_types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <resolv.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_media.h>
|
||||
#include <net/if_types.h>
|
||||
|
||||
#include <File.h>
|
||||
#include <Path.h>
|
||||
#include <String.h>
|
||||
|
||||
#include <AutoDeleter.h>
|
||||
|
||||
|
||||
Setting::Setting(const char *name)
|
||||
:
|
||||
fAuto(true)
|
||||
{
|
||||
fSocket = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
fName = name;
|
||||
|
||||
ReadConfiguration();
|
||||
}
|
||||
|
||||
@@ -121,7 +124,6 @@ Setting::ReadConfiguration()
|
||||
ifreq *interface = (ifreq *)buffer;
|
||||
ifreq *end = (ifreq *)((uint8 *)buffer + size);
|
||||
|
||||
|
||||
while (interface < end) {
|
||||
route_entry& route = interface->ifr_route;
|
||||
|
||||
@@ -138,15 +140,15 @@ Setting::ReadConfiguration()
|
||||
if (route.gateway != NULL)
|
||||
addressSize += route.gateway->sa_len;
|
||||
|
||||
interface = (ifreq *)((addr_t)interface +
|
||||
IF_NAMESIZE + sizeof(route_entry) + addressSize);
|
||||
interface = (ifreq *)((addr_t)interface + IF_NAMESIZE
|
||||
+ sizeof(route_entry) + addressSize);
|
||||
}
|
||||
|
||||
uint32 flags = 0;
|
||||
if (ioctl(fSocket, SIOCGIFFLAGS, &request, sizeof(struct ifreq)) == 0)
|
||||
flags = request.ifr_flags;
|
||||
|
||||
fAuto = flags & IFF_AUTO_CONFIGURED;
|
||||
fAuto = (flags & IFF_AUTO_CONFIGURED) != 0;
|
||||
|
||||
if (ioctl(fSocket, SIOCGIFMEDIA, &request, sizeof(struct ifreq)) == 0)
|
||||
fMedia = request.ifr_media;
|
||||
@@ -154,45 +156,13 @@ Setting::ReadConfiguration()
|
||||
// read resolv.conf for the dns.
|
||||
fNameservers.MakeEmpty();
|
||||
|
||||
#define MATCH(line, name) \
|
||||
(!strncmp(line, name, sizeof(name) - 1) && \
|
||||
(line[sizeof(name) - 1] == ' ' || \
|
||||
line[sizeof(name) - 1] == '\t'))
|
||||
res_init();
|
||||
res_state state = __res_state();
|
||||
|
||||
|
||||
register FILE *fp = fopen("/etc/resolv.conf", "r");
|
||||
if (fp == NULL) {
|
||||
fprintf(stderr, "failed to open '/etc/resolv.conf' to "
|
||||
"read nameservers: %s\n", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
int nserv = 0;
|
||||
char buf[1024];
|
||||
register char *cp; //, **pp;
|
||||
// register int n;
|
||||
int MAXNS = 2;
|
||||
|
||||
// read the config file
|
||||
while (fgets(buf, sizeof(buf), fp) != NULL) {
|
||||
// skip comments
|
||||
if (*buf == ';' || *buf == '#')
|
||||
continue;
|
||||
|
||||
// read nameservers to query
|
||||
if (MATCH(buf, "nameserver") && nserv < MAXNS) {
|
||||
// char sbuf[2];
|
||||
cp = buf + sizeof("nameserver") - 1;
|
||||
while (*cp == ' ' || *cp == '\t')
|
||||
cp++;
|
||||
cp[strcspn(cp, ";# \t\n")] = '\0';
|
||||
if ((*cp != '\0') && (*cp != '\n')) {
|
||||
fNameservers.AddItem(new BString(cp));
|
||||
nserv++;
|
||||
}
|
||||
if (state != NULL) {
|
||||
for (int i = 0; i < state->nscount; i++) {
|
||||
fNameservers.AddItem(
|
||||
new BString(inet_ntoa(state->nsaddr_list[i].sin_addr)));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user