/* Copyright 1999 Mandrakesoft <fpons@mandrakesoft.com>
 *
 * The following file used by this one are copyrighted by RedHat and
 * are taken from kudzu :
 *   device.h
 *   serial.h
 *   serial.c
 * This file is taken from kudzu.c copyrighted by RedHat, 1999.
 *
 * This software may be freely redistributed under the terms of the GNU
 * public license.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "serial.h"
#include "device.h"

typedef struct device *(newFunc)(struct device *);
typedef int (initFunc)();
typedef struct device *(probeFunc)(enum deviceClass, int, struct device *);

char *classStrings[] = {
	"UNSPEC", "OTHER", "NETWORK", "SCSI", "VIDEO", "AUDIO",
	"MOUSE", "MODEM", "CDROM", "TAPE", "FLOPPY", "SCANNER",
	"HD", "RAID", "PRINTER", "CAPTURE", "KEYBOARD", NULL
};

struct device *newDevice(struct device *old, struct device *new) {
    if (!old) {
	if (!new) {
	    new = malloc(sizeof(struct device));
	    memset(new,'\0',sizeof(struct device));
	}
     new->type = CLASS_UNSPEC;
    } else {
	    new->type = old->type;
	    if (old->device) new->device = strdup(old->device);
	    if (old->driver) new->driver = strdup(old->driver);
	    if (old->desc) new->desc = strdup(old->desc);
    }
    new->newDevice = newDevice;
    new->freeDevice = freeDevice;
    new->compareDevice = compareDevice;
    return new;
}

void freeDevice(struct device *dev) {
    if (!dev) {
	    printf("freeDevice(null)\n");
	    abort(); /* return; */
    }
    if (dev->device) free (dev->device);
    if (dev->driver) free (dev->driver);
    if (dev->desc) free (dev->desc);
    free (dev);
}

void writeDevice(FILE *file, struct device *dev) {}
int compareDevice(struct device *dev1, struct device *dev2) { return 0; }

int main () {
  struct device* devices = NULL;
  struct serialDevice* serialDevice = NULL;

  devices = serialProbe(CLASS_UNSPEC, 0, devices);
  while (devices) {
    serialDevice = (struct serialDevice*)devices;

    printf("CLASS=");
    if (serialDevice->type == CLASS_UNSPEC) puts("UNSPEC"); else
    if (serialDevice->type == CLASS_OTHER) puts("OTHER"); else
    if (serialDevice->type == CLASS_NETWORK) puts("NETWORK"); else
    if (serialDevice->type == CLASS_SCSI) puts("SCSI"); else
    if (serialDevice->type == CLASS_MOUSE) puts("MOUSE"); else
    if (serialDevice->type == CLASS_AUDIO) puts("AUDIO"); else
    if (serialDevice->type == CLASS_CDROM) puts("CDROM"); else
    if (serialDevice->type == CLASS_MODEM) puts("MODEM"); else
    if (serialDevice->type == CLASS_VIDEO) puts("VIDEO"); else
    if (serialDevice->type == CLASS_TAPE) puts("TAPE"); else
    if (serialDevice->type == CLASS_FLOPPY) puts("FLOPPY"); else
    if (serialDevice->type == CLASS_SCANNER) puts("SCANNER"); else
    if (serialDevice->type == CLASS_HD) puts("HD"); else
    if (serialDevice->type == CLASS_RAID) puts("RAID"); else
    if (serialDevice->type == CLASS_PRINTER) puts("PRINTER"); else
    if (serialDevice->type == CLASS_CAPTURE) puts("CAPTURE"); else
    if (serialDevice->type == CLASS_KEYBOARD) puts("KEYBOARD"); else
    if (serialDevice->type == CLASS_MONITOR) puts("MONITOR"); else
    if (serialDevice->type == CLASS_USB) puts("USB"); else
    if (serialDevice->type == CLASS_SOCKET) puts("SOCKET"); else
    if (serialDevice->type == CLASS_FIREWIRE) puts("FIREWIRE"); else
    if (serialDevice->type == CLASS_IDE) puts("IDE");
    printf("BUS=SERIAL\n");
    printf("DEVICE=/dev/%s\n", serialDevice->device);
    printf("DRIVER=%s\n", serialDevice->driver);
    if (!serialDevice->pnpdesc) printf("DESCRIPTION=%s\n", serialDevice->desc);
    if (serialDevice->pnpmfr) printf("MANUFACTURER=%s\n", serialDevice->pnpmfr);
    if (serialDevice->pnpmodel) printf("MODEL=%s\n", serialDevice->pnpmodel);
    if (serialDevice->pnpcompat) printf("COMPAT=%s\n", serialDevice->pnpcompat);
    if (serialDevice->pnpdesc) printf("DESCRIPTION=%s\n", serialDevice->pnpdesc);
    printf("\n");
    
    devices=devices->next;
  }

  return 0;
}
tch'/></form></td></tr>
<tr><td class='sub'>Mageia Installer and base platform for many utilities</td><td class='sub right'>Thierry Vignaud [tv]</td></tr></table>
<table class='tabs'><tr><td>
<a href='/software/drakx/?h=10.42'>summary</a><a href='/software/drakx/refs/?h=10.42&amp;id=75934b664684403bd03279f3c416c803b703a942'>refs</a><a href='/software/drakx/log/?h=10.42'>log</a><a href='/software/drakx/tree/?h=10.42&amp;id=75934b664684403bd03279f3c416c803b703a942'>tree</a><a class='active' href='/software/drakx/commit/?h=10.42&amp;id=75934b664684403bd03279f3c416c803b703a942'>commit</a><a href='/software/drakx/diff/?h=10.42&amp;id=75934b664684403bd03279f3c416c803b703a942'>diff</a><a href='/software/drakx/stats/?h=10.42'>stats</a></td><td class='form'><form class='right' method='get' action='/software/drakx/log/'>
<input type='hidden' name='h' value='10.42'/><input type='hidden' name='id' value='75934b664684403bd03279f3c416c803b703a942'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='content'><div class='cgit-panel'><b>diff options</b><form method='get'><input type='hidden' name='h' value='10.42'/><input type='hidden' name='id' value='75934b664684403bd03279f3c416c803b703a942'/><table><tr><td colspan='2'/></tr><tr><td class='label'>context:</td><td class='ctrl'><select name='context' onchange='this.form.submit();'><option value='1'>1</option><option value='2'>2</option><option value='3' selected='selected'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='15'>15</option><option value='20'>20</option><option value='25'>25</option><option value='30'>30</option><option value='35'>35</option><option value='40'>40</option></select></td></tr><tr><td class='label'>space:</td><td class='ctrl'><select name='ignorews' onchange='this.form.submit();'><option value='0' selected='selected'>include</option><option value='1'>ignore</option></select></td></tr><tr><td class='label'>mode:</td><td class='ctrl'><select name='dt' onchange='this.form.submit();'><option value='0' selected='selected'>unified</option><option value='1'>ssdiff</option><option value='2'>stat only</option></select></td></tr><tr><td/><td class='ctrl'><noscript><input type='submit' value='reload'/></noscript></td></tr></table></form></div><table summary='commit info' class='commit-info'>
<tr><th>author</th><td>Olivier Blin &lt;oblin@mandriva.org&gt;</td><td class='right'>2004-11-05 10:34:19 +0000</td></tr>
<tr><th>committer</th><td>Olivier Blin &lt;oblin@mandriva.org&gt;</td><td class='right'>2004-11-05 10:34:19 +0000</td></tr>
<tr><th>commit</th><td colspan='2' class='sha1'><a href='/software/drakx/commit/?h=10.42&amp;id=75934b664684403bd03279f3c416c803b703a942'>75934b664684403bd03279f3c416c803b703a942</a> (<a href='/software/drakx/patch/?id=75934b664684403bd03279f3c416c803b703a942'>patch</a>)</td></tr>
<tr><th>tree</th><td colspan='2' class='sha1'><a href='/software/drakx/tree/?h=10.42&amp;id=75934b664684403bd03279f3c416c803b703a942'>61936fa9e763d7b3aa33b6d9dd560fbeb29392d4</a></td></tr>
<tr><th>parent</th><td colspan='2' class='sha1'><a href='/software/drakx/commit/?h=10.42&amp;id=0a4397923c19fb7cdc240f2febdb61fbab289477'>0a4397923c19fb7cdc240f2febdb61fbab289477</a> (<a href='/software/drakx/diff/?h=10.42&amp;id=75934b664684403bd03279f3c416c803b703a942&amp;id2=0a4397923c19fb7cdc240f2febdb61fbab289477'>diff</a>)</td></tr><tr><th>download</th><td colspan='2' class='sha1'><a href='/software/drakx/snapshot/drakx-75934b664684403bd03279f3c416c803b703a942.tar'>drakx-75934b664684403bd03279f3c416c803b703a942.tar</a><br/><a href='/software/drakx/snapshot/drakx-75934b664684403bd03279f3c416c803b703a942.tar.gz'>drakx-75934b664684403bd03279f3c416c803b703a942.tar.gz</a><br/><a href='/software/drakx/snapshot/drakx-75934b664684403bd03279f3c416c803b703a942.tar.bz2'>drakx-75934b664684403bd03279f3c416c803b703a942.tar.bz2</a><br/><a href='/software/drakx/snapshot/drakx-75934b664684403bd03279f3c416c803b703a942.tar.xz'>drakx-75934b664684403bd03279f3c416c803b703a942.tar.xz</a><br/><a href='/software/drakx/snapshot/drakx-75934b664684403bd03279f3c416c803b703a942.zip'>drakx-75934b664684403bd03279f3c416c803b703a942.zip</a><br/></td></tr></table>
<div class='commit-subject'>hide ifcfg files for non-root users if they contain a WEP key (#12177)</div><div class='commit-msg'></div><div class='diffstat-header'><a href='/software/drakx/diff/?h=10.42&amp;id=75934b664684403bd03279f3c416c803b703a942'>Diffstat</a></div><table summary='diffstat' class='diffstat'><tr><td class='mode'>-rw-r--r--</td><td class='upd'><a href='/software/drakx/diff/perl-install/network/network.pm?h=10.42&amp;id=75934b664684403bd03279f3c416c803b703a942'>perl-install/network/network.pm</a></td><td class='right'>2</td><td class='graph'><table summary='file diffstat' width='2%'><tr><td class='add' style='width: 100.0%;'/><td class='rem' style='width: 0.0%;'/><td class='none' style='width: 0.0%;'/></tr></table></td></tr>
</table><div class='diffstat-summary'>1 files changed, 2 insertions, 0 deletions</div><table summary='diff' class='diff'><tr><td><div class='head'>diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm<br/>index 53ea5d6f5..3a99c2f96 100644<br/>--- a/<a href='/software/drakx/tree/perl-install/network/network.pm?h=10.42&amp;id=0a4397923c19fb7cdc240f2febdb61fbab289477'>perl-install/network/network.pm</a><br/>+++ b/<a href='/software/drakx/tree/perl-install/network/network.pm?h=10.42&amp;id=75934b664684403bd03279f3c416c803b703a942'>perl-install/network/network.pm</a></div><div class='hunk'>@@ -167,6 +167,8 @@ sub write_interface_conf {</div><div class='ctx'>                 if_($intf-&gt;{DEVICE} =~ /^ippp\d+$/, qw(DIAL_ON_IFUP))</div><div class='ctx'>                );</div><div class='ctx'>     substInFile { s/^DEVICE='(`.*`)'/DEVICE=$1/g } $file; #- remove quotes if DEVICE is the result of a command</div><div class='add'>+</div><div class='add'>+    chmod $intf-&gt;{WIRELESS_ENC_KEY} ? 0700 : 0755, $file; #- hide WEP key for non-root users</div><div class='ctx'>     log::explanations("written $intf-&gt;{DEVICE} interface configuration in $file");</div><div class='ctx'> }</div><div class='ctx'> </div></td></tr></table></div> <!-- class=content -->
<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit v1.2.1</a> (<a href='https://git-scm.com/'>git 2.21.0</a>) at 2025-03-06 15:37:49 +0000</div>
</div> <!-- id=cgit -->
</body>
</html>