~ubuntu-branches/ubuntu/precise/net-snmp/precise

« back to all changes in this revision

Viewing changes to debian/patches/51_allow_g_groupname.patch

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2009-11-26 01:27:00 UTC
  • mfrom: (1.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091126012700-pox7w0a5j2x305h9
Tags: 5.4.2.1~dfsg-3ubuntu1
* Merge from debian testing.  Remaining changes:
  - Set Ubuntu maintainer address.
  - net-snmp-config: Use bash. (LP: #104738)
  - Removed multiuser option when calling update-rc.d. (LP: #254261)
  - debian/snmpd.init: LSBify the init script.
  - debian/patches/52_fix_snmpcmd_1_typo.patch: Adjust a typo in snmpcmd.1
    (LP: #250459)
  - debian/patches/99-fix-ubuntu-div0.patch: Fix dvision by zero.
    (LP: #426813).
 * Dropped patches:
   - debian/patches/101-fix-ipalias.patch: Applied upstream.
   - debian/patches/99-fix-net-snmp-syslog.patch: Applied upstream.
   - debian/patches/99-fix-perl-counter-in-subagent.patch: Applied upstream.
   - ebian/patches/103-fix-ubuntu-lmsensors.patch: No longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: agent/snmpd.c
2
 
===================================================================
3
 
--- net-snmp-5.4.1.orig/agent/snmpd.c   (Revision 17157)
4
 
+++ net-snmp-5.4.1/agent/snmpd.c        (Revision 17158)
5
 
@@ -574,8 +574,26 @@
6
 
 #if HAVE_UNISTD_H
7
 
         case 'g':
8
 
             if (optarg != NULL) {
9
 
+                char           *ecp;
10
 
+                int             gid;
11
 
+
12
 
+                gid = strtoul(optarg, &ecp, 10);
13
 
+                if (*ecp) {
14
 
+#if HAVE_GETPWNAM && HAVE_PWD_H
15
 
+                    struct group  *info;
16
 
+                    info = getgrnam(optarg);
17
 
+                    if (info) {
18
 
+                        gid = info->gr_gid;
19
 
+                    } else {
20
 
+#endif
21
 
+                        fprintf(stderr, "Bad group id: %s\n", optarg);
22
 
+                        exit(1);
23
 
+#if HAVE_GETPWNAM && HAVE_PWD_H
24
 
+                    }
25
 
+#endif
26
 
+                }
27
 
                 netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, 
28
 
-                                  NETSNMP_DS_AGENT_GROUPID, atoi(optarg));
29
 
+                                  NETSNMP_DS_AGENT_GROUPID, gid);
30
 
             } else {
31
 
                 usage(argv[0]);
32
 
             }