mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 04:50:30 +01:00
2006-02-03 Robert Love <rml@novell.com>
* src/nm-device-802-11-wireless.c, src/nm-device-802-11-wireless.h: Make nm_device_802_11_wireless_get_essid() return 'const char *' not 'char *'. * src/nm-ip4-config.c, src/nm-ip4-config.h: Make the functions nm_ip4_config_get_hostname() and nm_ip4_config_get_nis_domain() return 'const char *' not 'char *'. * src/backends/NetworkManagerSuSE.c: Fix up for above. Also, do not leak g_strdup() result. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1437 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
89a76ad10e
commit
133134e225
6 changed files with 35 additions and 19 deletions
11
ChangeLog
11
ChangeLog
|
|
@ -1,3 +1,14 @@
|
|||
2006-02-03 Robert Love <rml@novell.com>
|
||||
|
||||
* src/nm-device-802-11-wireless.c, src/nm-device-802-11-wireless.h:
|
||||
Make nm_device_802_11_wireless_get_essid() return 'const char *' not
|
||||
'char *'.
|
||||
* src/nm-ip4-config.c, src/nm-ip4-config.h: Make the functions
|
||||
nm_ip4_config_get_hostname() and
|
||||
nm_ip4_config_get_nis_domain() return 'const char *' not 'char *'.
|
||||
* src/backends/NetworkManagerSuSE.c: Fix up for above. Also, do not
|
||||
leak g_strdup() result.
|
||||
|
||||
2006-02-03 Robert Love <rml@novell.com>
|
||||
|
||||
* src/NetworkManagerAP.c: In nm_ap_new(), default new networks to
|
||||
|
|
|
|||
|
|
@ -922,7 +922,8 @@ out_gfree:
|
|||
void nm_system_activate_nis (NMIP4Config *config)
|
||||
{
|
||||
shvarFile *file;
|
||||
gchar *nis_domain, *name, *buf = NULL;
|
||||
const char *nis_domain;
|
||||
char *name, *buf = NULL;
|
||||
int num_nis_servers = 0;
|
||||
struct in_addr temp_addr;
|
||||
int i;
|
||||
|
|
@ -1021,15 +1022,13 @@ void nm_system_shutdown_nis (void)
|
|||
*/
|
||||
void nm_system_set_hostname (NMIP4Config *config)
|
||||
{
|
||||
char *filename, *h_name = NULL, *buf;
|
||||
shvarFile *file;
|
||||
gchar *name, *buf, *hostname = NULL;
|
||||
struct in_addr temp_addr;
|
||||
struct hostent *host = NULL;
|
||||
|
||||
g_return_if_fail (config != NULL);
|
||||
|
||||
name = g_strdup_printf (SYSCONFDIR"/sysconfig/network/dhcp");
|
||||
file = svNewFile (name);
|
||||
filename = g_strdup_printf (SYSCONFDIR"/sysconfig/network/dhcp");
|
||||
file = svNewFile (filename);
|
||||
if (!file)
|
||||
goto out_gfree;
|
||||
|
||||
|
|
@ -1039,16 +1038,21 @@ void nm_system_set_hostname (NMIP4Config *config)
|
|||
|
||||
if (!strcmp (buf, "yes"))
|
||||
{
|
||||
const char *hostname;
|
||||
|
||||
hostname = nm_ip4_config_get_hostname (config);
|
||||
if (!hostname)
|
||||
{
|
||||
struct in_addr temp_addr;
|
||||
struct hostent *host;
|
||||
|
||||
/* try to get hostname via dns */
|
||||
temp_addr.s_addr = nm_ip4_config_get_address (config);
|
||||
host = gethostbyaddr ((char *) &temp_addr, sizeof (temp_addr), AF_INET);
|
||||
if (host)
|
||||
{
|
||||
hostname = g_strdup (host->h_name);
|
||||
hostname = strtok (hostname, ".");
|
||||
h_name = g_strdup (host->h_name);
|
||||
hostname = strtok (h_name, ".");
|
||||
}
|
||||
else
|
||||
nm_warning ("nm_system_set_hostname(): gethostbyaddr failed, h_errno = %d", h_errno);
|
||||
|
|
@ -1061,10 +1065,11 @@ void nm_system_set_hostname (NMIP4Config *config)
|
|||
nm_warning ("Could not set hostname.");
|
||||
}
|
||||
}
|
||||
free (buf);
|
||||
|
||||
g_free (h_name);
|
||||
free (buf);
|
||||
out_close:
|
||||
svCloseFile (file);
|
||||
out_gfree:
|
||||
g_free (name);
|
||||
g_free (filename);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -465,7 +465,7 @@ link_to_specific_ap (NMDevice80211Wireless *self,
|
|||
|
||||
if (is_associated (self))
|
||||
{
|
||||
char * dev_essid = nm_device_802_11_wireless_get_essid (self);
|
||||
const char * dev_essid = nm_device_802_11_wireless_get_essid (self);
|
||||
const char * ap_essid = nm_ap_get_essid (ap);
|
||||
|
||||
if (dev_essid && ap_essid && !strcmp (dev_essid, ap_essid))
|
||||
|
|
@ -1171,7 +1171,7 @@ out:
|
|||
* Returns: allocated string containing essid. Must be freed by caller.
|
||||
*
|
||||
*/
|
||||
char *
|
||||
const char *
|
||||
nm_device_802_11_wireless_get_essid (NMDevice80211Wireless *self)
|
||||
{
|
||||
NMSock * sk;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ void nm_device_802_11_wireless_set_address (NMDevice80211Wireless *dev);
|
|||
void nm_device_802_11_wireless_get_bssid (NMDevice80211Wireless *dev,
|
||||
struct ether_addr *bssid);
|
||||
|
||||
char * nm_device_802_11_wireless_get_essid (NMDevice80211Wireless *self);
|
||||
const char * nm_device_802_11_wireless_get_essid (NMDevice80211Wireless *self);
|
||||
|
||||
gboolean nm_device_802_11_wireless_set_mode (NMDevice80211Wireless *self,
|
||||
const int mode);
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ void nm_ip4_config_set_hostname (NMIP4Config *config, const char *hostname)
|
|||
config->hostname = g_strdup (hostname);
|
||||
}
|
||||
|
||||
gchar *nm_ip4_config_get_hostname (NMIP4Config *config)
|
||||
const char *nm_ip4_config_get_hostname (NMIP4Config *config)
|
||||
{
|
||||
g_return_val_if_fail (config != NULL, NULL);
|
||||
|
||||
|
|
@ -301,7 +301,7 @@ void nm_ip4_config_set_nis_domain (NMIP4Config *config, const char *domain)
|
|||
config->nis_domain = g_strdup (domain);
|
||||
}
|
||||
|
||||
gchar *nm_ip4_config_get_nis_domain (NMIP4Config *config)
|
||||
const char *nm_ip4_config_get_nis_domain (NMIP4Config *config)
|
||||
{
|
||||
g_return_val_if_fail( config != NULL, NULL);
|
||||
return config->nis_domain;
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@ void nm_ip4_config_add_nis_server (NMIP4Config *config, guint32 nis_server);
|
|||
guint32 nm_ip4_config_get_nis_server (NMIP4Config *config, guint i);
|
||||
guint32 nm_ip4_config_get_num_nis_servers (NMIP4Config *config);
|
||||
|
||||
void nm_ip4_config_set_hostname (NMIP4Config *config, const char *hostname);
|
||||
gchar *nm_ip4_config_get_hostname (NMIP4Config *config);
|
||||
void nm_ip4_config_set_hostname (NMIP4Config *config, const char *hostname);
|
||||
const char * nm_ip4_config_get_hostname (NMIP4Config *config);
|
||||
|
||||
void nm_ip4_config_set_nis_domain (NMIP4Config *config, const char *domain);
|
||||
gchar *nm_ip4_config_get_nis_domain (NMIP4Config *config);
|
||||
void nm_ip4_config_set_nis_domain (NMIP4Config *config, const char *domain);
|
||||
const char * nm_ip4_config_get_nis_domain (NMIP4Config *config);
|
||||
|
||||
void nm_ip4_config_add_domain (NMIP4Config *config, const char *domain);
|
||||
const char * nm_ip4_config_get_domain (NMIP4Config *config, guint i);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue