Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifdef HAVE_CONFIG_H
00024 # include "config.h"
00025 #endif
00026
00027
00028 #include "validate.h"
00029
00030
00031 #include <string.h>
00032
00033 bool
00034 scram_valid_client_first (struct scram_client_first *cf)
00035 {
00036
00037 switch (cf->cbflag)
00038 {
00039 case 'p':
00040 case 'n':
00041 case 'y':
00042 break;
00043
00044 default:
00045 return false;
00046 }
00047
00048
00049 if (cf->cbflag == 'p' && cf->cbname == NULL)
00050 return false;
00051 else if (cf->cbflag != 'p' && cf->cbname != NULL)
00052 return false;
00053
00054
00055
00056
00057 if (cf->username == NULL || *cf->username == '\0')
00058 return false;
00059
00060
00061 if (cf->client_nonce == NULL || *cf->client_nonce == '\0')
00062 return false;
00063
00064
00065 if (strchr (cf->client_nonce, ','))
00066 return false;
00067
00068 return true;
00069 }
00070
00071 bool
00072 scram_valid_server_first (struct scram_server_first *sf)
00073 {
00074
00075 if (sf->nonce == NULL || *sf->nonce == '\0')
00076 return false;
00077
00078
00079 if (strchr (sf->nonce, ','))
00080 return false;
00081
00082
00083 if (sf->salt == NULL || *sf->salt == '\0')
00084 return false;
00085
00086
00087 if (strchr (sf->salt, ','))
00088 return false;
00089
00090 if (sf->iter == 0)
00091 return false;
00092
00093 return true;
00094 }
00095
00096 bool
00097 scram_valid_client_final (struct scram_client_final *cl)
00098 {
00099
00100 if (cl->cbind == NULL || *cl->cbind == '\0')
00101 return false;
00102
00103
00104 if (strchr (cl->cbind, ','))
00105 return false;
00106
00107
00108 if (cl->nonce == NULL || *cl->nonce == '\0')
00109 return false;
00110
00111
00112 if (strchr (cl->nonce, ','))
00113 return false;
00114
00115
00116 if (cl->proof == NULL || *cl->proof == '\0')
00117 return false;
00118
00119
00120 if (strchr (cl->proof, ','))
00121 return false;
00122
00123 return true;
00124 }
00125
00126 bool
00127 scram_valid_server_final (struct scram_server_final *sl)
00128 {
00129
00130 if (sl->verifier == NULL || *sl->verifier == '\0')
00131 return false;
00132
00133
00134 if (strchr (sl->verifier, ','))
00135 return false;
00136
00137 return true;
00138 }