mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-21 18:00:38 +01:00
2006-05-11 Dan Williams <dcbw@redhat.com>
Patch from Michael Biebl <biebl@teco.edu> * src/backends/NetworkManagerDebian.c - Debian backend fixups git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1727 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
3359a3f374
commit
15a5def1ee
2 changed files with 30 additions and 5 deletions
|
|
@ -1,3 +1,9 @@
|
|||
2006-05-11 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
Patch from Michael Biebl <biebl@teco.edu>
|
||||
* src/backends/NetworkManagerDebian.c
|
||||
- Debian backend fixups
|
||||
|
||||
2006-05-10 Robert Love <rml@novell.com>
|
||||
|
||||
* src/backends/NetworkManagerSuSE.c: Fix double free (Novell #173442).
|
||||
|
|
|
|||
|
|
@ -50,6 +50,10 @@ void add_block(const char *type, const char* name)
|
|||
|
||||
void add_data(const char *key,const char *data)
|
||||
{
|
||||
// Check if there is a block where we can attach our data
|
||||
if (first == NULL)
|
||||
return;
|
||||
|
||||
if_data *ret = (if_data*)calloc(1,sizeof(struct _if_data));
|
||||
ret->key = g_strdup(key);
|
||||
ret->data = g_strdup(data);
|
||||
|
|
@ -73,6 +77,10 @@ void ifparser_init(void)
|
|||
{
|
||||
FILE *inp = fopen(INTERFACES,"r");
|
||||
int ret = 0;
|
||||
char *line;
|
||||
char *space;
|
||||
char rline[255];
|
||||
|
||||
if (inp == NULL)
|
||||
{
|
||||
nm_warning ("Error: Can't open %s\n",INTERFACES);
|
||||
|
|
@ -81,10 +89,16 @@ void ifparser_init(void)
|
|||
first = last = NULL;
|
||||
while(1)
|
||||
{
|
||||
char *line,rline[255],*space;
|
||||
line = space = NULL;
|
||||
ret = fscanf(inp,"%255[^\n]\n",rline);
|
||||
if (ret == EOF)
|
||||
break;
|
||||
// If the line did not match, skip it
|
||||
if (ret == 0) {
|
||||
fgets(rline, 255, inp);
|
||||
continue;
|
||||
}
|
||||
|
||||
line = rline;
|
||||
while(line[0] == ' ')
|
||||
line++;
|
||||
|
|
@ -94,18 +108,19 @@ void ifparser_init(void)
|
|||
SPACE_OR_TAB(line,space)
|
||||
if (space == NULL)
|
||||
{
|
||||
nm_warning ("Error: Can't parse interface line '%s'\n",line);
|
||||
nm_warning ("Error: Can't parse interface line '%s'\n",line);
|
||||
continue;
|
||||
}
|
||||
space[0] = '\0';
|
||||
|
||||
|
||||
// There are four different stanzas:
|
||||
// iface, mapping, auto and allow-*. Create a block for each of them.
|
||||
if (strcmp(line,"iface")==0)
|
||||
{
|
||||
char *space2 = strchr(space+1,' ');
|
||||
if (space2 == NULL)
|
||||
{
|
||||
nm_warning ("Error: Can't parse iface line '%s'\n",space+1);
|
||||
nm_warning ("Error: Can't parse iface line '%s'\n",space+1);
|
||||
continue;
|
||||
}
|
||||
space2[0]='\0';
|
||||
|
|
@ -116,7 +131,7 @@ void ifparser_init(void)
|
|||
space = strchr(space2+1,' ');
|
||||
if (space == NULL)
|
||||
{
|
||||
nm_warning ("Error: Can't parse data '%s'\n",space2+1);
|
||||
nm_warning ("Error: Can't parse data '%s'\n",space2+1);
|
||||
continue;
|
||||
}
|
||||
space[0] = '\0';
|
||||
|
|
@ -125,6 +140,10 @@ void ifparser_init(void)
|
|||
}
|
||||
else if (strcmp(line,"auto")==0)
|
||||
add_block(line,space+1);
|
||||
else if (strcmp(line,"mapping")==0)
|
||||
add_block(line,space+1);
|
||||
else if (strncmp(line,"allow-",6)==0)
|
||||
add_block(line,space+1);
|
||||
else
|
||||
add_data(line,space+1);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue