Author: phoudoin Date: 2010-03-18 09:48:13 +0100 (Thu, 18 Mar 2010) New Revision: 35898 Changeset: http://dev.haiku-os.org/changeset/35898/haiku Modified: haiku/trunk/docs/userguide/de/preferences/network.html haiku/trunk/docs/userguide/en/preferences/network.html haiku/trunk/docs/userguide/es/preferences/network.html haiku/trunk/docs/userguide/fr/preferences/network.html haiku/trunk/docs/userguide/it/preferences/network.html haiku/trunk/docs/userguide/jp/preferences/network.html haiku/trunk/docs/userguide/ru/preferences/network.html haiku/trunk/docs/userguide/sv_SE/preferences/network.html haiku/trunk/src/preferences/mail/AutoConfig.h haiku/trunk/src/preferences/mail/DNSQuery.cpp haiku/trunk/src/preferences/network/EthernetSettingsView.cpp haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/EthernetSettingsView.cpp haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/Setting.cpp Log: Fixed last places where resolv.conf was still expected under /etc, UserGuide included. Fixed authentication misspelling Modified: haiku/trunk/docs/userguide/de/preferences/network.html =================================================================== --- haiku/trunk/docs/userguide/de/preferences/network.html 2010-03-18 06:31:01 UTC (rev 35897) +++ haiku/trunk/docs/userguide/de/preferences/network.html 2010-03-18 08:48:13 UTC (rev 35898) @@ -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" /> Modified: haiku/trunk/docs/userguide/en/preferences/network.html =================================================================== --- haiku/trunk/docs/userguide/en/preferences/network.html 2010-03-18 06:31:01 UTC (rev 35897) +++ haiku/trunk/docs/userguide/en/preferences/network.html 2010-03-18 08:48:13 UTC (rev 35898) @@ -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" /> Modified: haiku/trunk/docs/userguide/es/preferences/network.html =================================================================== --- haiku/trunk/docs/userguide/es/preferences/network.html 2010-03-18 06:31:01 UTC (rev 35897) +++ haiku/trunk/docs/userguide/es/preferences/network.html 2010-03-18 08:48:13 UTC (rev 35898) @@ -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" /> Modified: haiku/trunk/docs/userguide/fr/preferences/network.html =================================================================== --- haiku/trunk/docs/userguide/fr/preferences/network.html 2010-03-18 06:31:01 UTC (rev 35897) +++ haiku/trunk/docs/userguide/fr/preferences/network.html 2010-03-18 08:48:13 UTC (rev 35898) @@ -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" /> Modified: haiku/trunk/docs/userguide/it/preferences/network.html =================================================================== --- haiku/trunk/docs/userguide/it/preferences/network.html 2010-03-18 06:31:01 UTC (rev 35897) +++ haiku/trunk/docs/userguide/it/preferences/network.html 2010-03-18 08:48:13 UTC (rev 35898) @@ -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" /> Modified: haiku/trunk/docs/userguide/jp/preferences/network.html =================================================================== --- haiku/trunk/docs/userguide/jp/preferences/network.html 2010-03-18 06:31:01 UTC (rev 35897) +++ haiku/trunk/docs/userguide/jp/preferences/network.html 2010-03-18 08:48:13 UTC (rev 35898) @@ -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" /> Modified: haiku/trunk/docs/userguide/ru/preferences/network.html =================================================================== --- haiku/trunk/docs/userguide/ru/preferences/network.html 2010-03-18 06:31:01 UTC (rev 35897) +++ haiku/trunk/docs/userguide/ru/preferences/network.html 2010-03-18 08:48:13 UTC (rev 35898) @@ -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" /> Modified: haiku/trunk/docs/userguide/sv_SE/preferences/network.html =================================================================== --- haiku/trunk/docs/userguide/sv_SE/preferences/network.html 2010-03-18 06:31:01 UTC (rev 35897) +++ haiku/trunk/docs/userguide/sv_SE/preferences/network.html 2010-03-18 08:48:13 UTC (rev 35898) @@ -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" /> Modified: haiku/trunk/src/preferences/mail/AutoConfig.h =================================================================== --- haiku/trunk/src/preferences/mail/AutoConfig.h 2010-03-18 06:31:01 UTC (rev 35897) +++ haiku/trunk/src/preferences/mail/AutoConfig.h 2010-03-18 08:48:13 UTC (rev 35898) @@ -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 @@ -#endif \ No newline at end of file +#endif Modified: haiku/trunk/src/preferences/mail/DNSQuery.cpp =================================================================== --- haiku/trunk/src/preferences/mail/DNSQuery.cpp 2010-03-18 06:31:01 UTC (rev 35897) +++ haiku/trunk/src/preferences/mail/DNSQuery.cpp 2010-03-18 08:48:13 UTC (rev 35898) @@ -1,12 +1,14 @@ #include "DNSQuery.h" +#include <errno.h> +#include <stdio.h> + #include <ByteOrder.h> +#include <FindDirectory.h> #include <NetAddress.h> #include <NetEndpoint.h> +#include <Path.h> -#include <errno.h> -#include <stdio.h> - // #define DEBUG 1 #undef PRINT @@ -155,11 +157,16 @@ (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; } Modified: haiku/trunk/src/preferences/network/EthernetSettingsView.cpp =================================================================== --- haiku/trunk/src/preferences/network/EthernetSettingsView.cpp 2010-03-18 06:31:01 UTC (rev 35897) +++ haiku/trunk/src/preferences/network/EthernetSettingsView.cpp 2010-03-18 08:48:13 UTC (rev 35898) @@ -388,7 +388,7 @@ 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; } Modified: haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/EthernetSettingsView.cpp =================================================================== --- haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/EthernetSettingsView.cpp 2010-03-18 06:31:01 UTC (rev 35897) +++ haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/EthernetSettingsView.cpp 2010-03-18 08:48:13 UTC (rev 35898) @@ -276,10 +276,15 @@ 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; } Modified: haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/Setting.cpp =================================================================== --- haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/Setting.cpp 2010-03-18 06:31:01 UTC (rev 35897) +++ haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/Setting.cpp 2010-03-18 08:48:13 UTC (rev 35898) @@ -5,37 +5,40 @@ * Author: * Andre Alves Garzia, andre@xxxxxxxxxxxxxxx */ - -#include "Setting.h" -#include <String.h> -#include <File.h> -#include <Path.h> - -#include <SupportDefs.h> -#include <AutoDeleter.h> +#include "Setting.h" + #include <arpa/inet.h> +#include <errno.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 <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 @@ ifreq *interface = (ifreq *)buffer; ifreq *end = (ifreq *)((uint8 *)buffer + size); - while (interface < end) { route_entry& route = interface->ifr_route; @@ -138,15 +140,15 @@ 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 @@ // 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); }