/[radius]/radius/radiusd/radutil.c
ViewVC logotype

Diff of /radius/radiusd/radutil.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.38 by gray, Wed Jun 11 15:03:59 2003 UTC revision 1.39 by gray, Thu Jun 12 09:34:14 2003 UTC
# Line 37  obstack_grow_quoted(struct obstack *obp, Line 37  obstack_grow_quoted(struct obstack *obp,
37                  case '\'':                  case '\'':
38                  case '\\':                  case '\\':
39                          obstack_1grow(obp, '\\');                          obstack_1grow(obp, '\\');
40                            obstack_1grow(obp, *str);
41                            break;
42                            
43                  default:                  default:
44                          obstack_1grow(obp, *str);                          if (isprint(*str))
45                                    obstack_1grow(obp, *str);
46                            else {
47                                    char buf[4];
48                                    snprintf(buf, sizeof(buf), "%03o",
49                                             *(u_char*)str);
50                                    obstack_1grow(obp, '\\');
51                                    obstack_grow(obp, str, 3);
52                            }
53                  }                  }
54          }          }
55  }  }
# Line 77  attr_to_str(struct obstack *obp, RADIUS_ Line 88  attr_to_str(struct obstack *obp, RADIUS_
88  {  {
89          VALUE_PAIR *pair;          VALUE_PAIR *pair;
90          int len;          int len;
91          char tmp[AUTH_STRING_LEN];          char tmp[AUTH_STRING_LEN + 1];
92                    char *str;
93            
94          if (!attr) {          if (!attr) {
95                  radlog_req(L_ERR, req, "attribute not found");                  radlog_req(L_ERR, req, "attribute not found");
96                  return;                  return;
# Line 138  attr_to_str(struct obstack *obp, RADIUS_ Line 150  attr_to_str(struct obstack *obp, RADIUS_
150          case TYPE_STRING:          case TYPE_STRING:
151                  if ((attr->value == DA_USER_PASSWORD                  if ((attr->value == DA_USER_PASSWORD
152                       || attr->value == DA_CHAP_PASSWORD) && req) {                       || attr->value == DA_CHAP_PASSWORD) && req) {
153                          char string[AUTH_STRING_LEN+1];                          req_decrypt_password(tmp, req, pair);
154                          int len;                          str = tmp;
155                          req_decrypt_password(string, req, pair);                  } else
156                          if (attr->value == DA_USER_PASSWORD)                          str = pair->avp_strvalue;
157                                  len = strlen(string);  
158                          else                  if (attr->prop & AP_BINARY_STRING)
159                                  len = pair->avp_strlength;                          len = pair->avp_strlength;
160                          obstack_grow_quoted(obp, string, len);                  else
161                  } else {                          /* strvalue might include terminating zero
162                          obstack_grow_quoted(obp,                             character, so we need to recalculate it */
163                                              pair->avp_strvalue,                          len = strlen(str);
164                                              pair->avp_strlength);                  obstack_grow_quoted(obp, str, len);
                 }  
165                  break;                  break;
166                                    
167          case TYPE_INTEGER:          case TYPE_INTEGER:

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.39

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26