~ubuntu-branches/ubuntu/wily/net-snmp/wily-proposed

« back to all changes in this revision

Viewing changes to agent/mibgroup/smux/smux.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-28 14:59:36 UTC
  • mfrom: (1.2.3 upstream) (1.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20100628145936-cbiallic69pn044g
Tags: 5.4.3~dfsg-1ubuntu1
* Merge from debian unstable.  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/snmpd.postinst: source debconf before doing work, LP: #589056
  - debian/snmp.preinst, debian/snmp.prerm: kill any/all processes owned by
    snmp user before install/uninstall, LP: #573391
  - Add apport hook (LP: #533603):
  - debian/{snmp,snmpd}.apport: Added.
  - debian/control: Build-depends on dh-apport.
  - debian/rules: 
    + Add --with apport.
    + override_dh_apport to install hook on snmpd package only.
 * Dropped patches:
   - debian/patches/99-fix-ubuntu-div0.patch: Fix dvision by zero.. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
{
140
140
    smux_peer_auth *aptr;
141
141
    char           *password_cptr;
142
 
    int             cptr_len;
 
142
    int             rv;
143
143
 
144
144
    if ((aptr =
145
145
         (smux_peer_auth *) calloc(1, sizeof(smux_peer_auth))) == NULL) {
151
151
        return;
152
152
    }
153
153
 
 
154
    password_cptr = strchr(cptr, ' ');
 
155
    if (password_cptr)
 
156
        *(password_cptr++) = '\0';
 
157
 
154
158
    /*
155
159
     * oid 
156
160
     */
157
161
    aptr->sa_active_fd = -1;
158
162
    aptr->sa_oid_len = MAX_OID_LEN;
159
 
    read_objid( cptr, aptr->sa_oid, &aptr->sa_oid_len );
 
163
    rv = read_objid( cptr, aptr->sa_oid, &aptr->sa_oid_len );
160
164
    DEBUGMSGTL(("smux_conf", "parsing registration for: %s\n", cptr));
161
 
 
162
 
    password_cptr = strchr(cptr, ' ');
163
 
    cptr_len = strlen(cptr);
 
165
    if (!rv)
 
166
        config_perror("Error parsing smux oid");
164
167
 
165
168
    if (password_cptr != NULL) {    /* Do we have a password or not? */
166
 
        *password_cptr = 0x0;
167
 
        if ((&password_cptr - &cptr + 1) < cptr_len) {
168
 
            cptr = ++password_cptr;
169
169
            DEBUGMSGTL(("smux_conf", "password is: %s\n",
170
 
                        SNMP_STRORNULL(cptr)));
171
 
        }
 
170
                        SNMP_STRORNULL(password_cptr)));
172
171
 
173
172
        /*
174
173
         * password 
175
174
         */
176
 
        if (cptr)
177
 
            strcpy(aptr->sa_passwd, cptr);
 
175
        if (*password_cptr) {
 
176
            strncpy(aptr->sa_passwd, password_cptr, SMUXMAXSTRLEN-1);
 
177
            aptr->sa_passwd[SMUXMAXSTRLEN-1] = '\0';
 
178
        }
178
179
    } else {
179
180
        /*
180
181
         * null passwords OK