NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/43407: ifconfig does not handle carp ifs properly



The following reply was made to PR bin/43407; it has been noted by GNATS.

From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/43407: ifconfig does not handle carp ifs properly
Date: Sat, 26 Mar 2011 20:56:58 +0000

 On Wed, Jun 02, 2010 at 03:55:00PM +0000, 
peter.okane%it.nuigalway.ie@localhost wrote:
  > ifconfig carpN state xxxx fails and give useage message
 
 It looks like the state keywords have become all caps - try that.
 
  > ifconfig carpN pass passphrase does not set the passphrase correctly.
 
 The following completely untested patch might help. It's based on the
 fix in version 1.13 of carp.c for the "carpdev" command -- it looks to
 me as if the password should be handled the same way... maybe. If it
 works, let me know.
 
 You may also want to apply the version 1.13 fix to your tree, which
 you can do with "cvs update -j1.12 -j1.13 carp.c". 
 
 Index: carp.c
 ===================================================================
 RCS file: /cvsroot/src/sbin/ifconfig/carp.c,v
 retrieving revision 1.13
 diff -u -p -r1.13 carp.c
 --- carp.c     11 Sep 2009 23:22:28 -0000      1.13
 +++ carp.c     26 Mar 2011 20:53:24 -0000
 @@ -155,10 +155,10 @@ int
  setcarp_passwd(prop_dictionary_t env, prop_dictionary_t oenv)
  {
        struct carpreq carpr;
 -      prop_data_t data;
 +      prop_string_t s;
  
 -      data = (prop_data_t)prop_dictionary_get(env, "pass");
 -      if (data == NULL) {
 +      s = (prop_string_t)prop_dictionary_get(env, "pass");
 +      if (s == NULL) {
                errno = ENOENT;
                return -1;
        }
 @@ -167,8 +167,8 @@ setcarp_passwd(prop_dictionary_t env, pr
  
        memset(carpr.carpr_key, 0, sizeof(carpr.carpr_key));
        /* XXX Should hash the password into the key here, perhaps? */
 -      strlcpy((char *)carpr.carpr_key, prop_data_data_nocopy(data),
 -          MIN(CARP_KEY_LEN, prop_data_size(data)));
 +      strlcpy((char *)carpr.carpr_key, prop_string_cstring_nocopy(s),
 +          sizeof(carpr.carpr_key));
  
        carp_set(env, &carpr);
        return 0;
 
 
 -- 
 David A. Holland
 dholland%netbsd.org@localhost
 


Home | Main Index | Thread Index | Old Index