Guest

Untitled

By: a guest on Jan 2nd, 2012  |  syntax: C  |  size: 0.67 KB  |  hits: 74  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. int wps_is_selected_pin_registrar(const struct wpabuf *msg)
  2. {
  3.         struct wps_parse_attr attr;
  4.  
  5.         /*
  6.          * In theory, this could also verify that attr.sel_reg_config_methods
  7.          * includes WPS_CONFIG_LABEL, WPS_CONFIG_DISPLAY, or WPS_CONFIG_KEYPAD,
  8.          * but some deployed AP implementations do not set Selected Registrar
  9.          * Config Methods attribute properly, so it is safer to just use
  10.          * Device Password ID here.
  11.          */
  12.  
  13.         if (wps_parse_msg(msg, &attr) < 0)
  14.                 return 0;
  15.  
  16.         if (!attr.selected_registrar || *attr.selected_registrar == 0)
  17.                 return 0;
  18.  
  19.         if (attr.dev_password_id != NULL &&
  20.             WPA_GET_BE16(attr.dev_password_id) == DEV_PW_PUSHBUTTON)
  21.                 return 0;
  22.  
  23.         return 1;
  24. }