Changeset 4745:1e974ec321bd in roaraudio for roard
- Timestamp:
- 01/31/11 15:16:14 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/auth.c
r4739 r4745 115 115 } 116 116 117 int auth_client_ckeck(struct roar_client_server * cs, struct roar_auth_message * authmes ) {117 int auth_client_ckeck(struct roar_client_server * cs, struct roar_auth_message * authmes, int * next) { 118 118 struct auth_key * key; 119 119 int i; 120 120 int ret; 121 121 122 if ( cs == NULL || authmes == NULL ) 123 return -1; 122 if ( cs == NULL || authmes == NULL || next == NULL ) 123 return -1; 124 125 *next = -1; 124 126 125 127 for (i = 0; i < AUTH_KEYRING_LEN; i++) { … … 150 152 /* ignore this case and continue */ 151 153 break; 152 case 0: 154 case 0: // fatal auth error (server side auth cancel) 153 155 return 0; 154 156 break; … … 163 165 } 164 166 } 167 168 // make a better guess: 169 /* 170 if ( authmes->type == ROAR_AUTH_T_PASSWORD ) { 171 *next = -1; 172 } else { 173 *next = ROAR_AUTH_T_PASSWORD; 174 } 175 */ 165 176 166 177 return -1; -
roard/include/auth.h
r4708 r4745 72 72 union auth_typeunion * auth_regkey_simple(int type, enum roard_client_acclev acclev); 73 73 74 int auth_client_ckeck(struct roar_client_server * cs, struct roar_auth_message * authmes); 75 74 int auth_client_ckeck(struct roar_client_server * cs, struct roar_auth_message * authmes, int * next); 76 75 77 76 int auth_addkey_anonymous(enum roard_client_acclev acclev); -
roard/req.c
r4740 r4745 100 100 101 101 int req_on_auth (int client, struct roar_message * mes, char ** data, uint32_t flags[2]) { 102 struct roar_error_frame error_frame; 103 void * error_data; 104 struct roar_message error_mes; 102 105 struct roar_client_server * cs; 103 106 struct roar_auth_message authmes; 107 int next = -1; 104 108 int ret; 105 109 … … 114 118 client, roar_autht2str(authmes.type), authmes.type); 115 119 116 ret = auth_client_ckeck(cs, &authmes); 117 118 if ( ret != 1 ) 119 return -1; 120 ret = auth_client_ckeck(cs, &authmes, &next); 121 122 if ( ret != 1 ) { 123 if ( next != -1 ) { 124 memset(&authmes, 0, sizeof(authmes)); 125 126 authmes.type = next; 127 128 if ( roar_auth_to_mes(&error_mes, NULL, &authmes) == -1 ) 129 return -1; 130 131 if ( roar_err_int(&error_frame) == -1 ) 132 return -1; 133 134 error_frame.ra_errno = ROAR_ERROR_PERM; 135 error_frame.datalen = error_mes.datalen; 136 137 error_data = roar_err_buildmsg(mes, &error_frame); 138 139 memcpy(error_data, error_mes.data, error_mes.datalen); 140 141 mes->cmd = ROAR_CMD_ERROR; 142 mes->pos = g_pos; 143 return 0; 144 } 145 146 return -1; 147 } 120 148 121 149 mes->cmd = ROAR_CMD_OK;
Note: See TracChangeset
for help on using the changeset viewer.