Definition at line 44 of file auth-sasl.c.
46{
48 int mtype;
50 void *opaq = NULL;
52 int outputlen = 0;
54 int inputlen;
55 int result;
56 bool initial;
57
58
59
60
61
63
65
67
70
71
72
73
74
75
76
77 initial = true;
78 do
79 {
83 {
84
85 if (mtype != EOF)
86 {
88 (
errcode(ERRCODE_PROTOCOL_VIOLATION),
89 errmsg(
"expected SASL response, got message type %d",
90 mtype)));
91 }
92 else
94 }
95
96
99 {
100
103 }
104
105 elog(
DEBUG4,
"processing received SASL response of length %d",
buf.len);
106
107
108
109
110
111
112
113 if (initial)
114 {
115 const char *selected_mech;
116
118
119
120
121
122
123
124
125
126
127
128
129
130
131 opaq = mech->
init(
port, selected_mech, shadow_pass);
132
134 if (inputlen == -1)
136 else
138
139 initial = false;
140 }
141 else
142 {
145 }
147
148
149
150
151
153
154
155
156
159 logdetail);
160
161
163
165 {
166
167
168
169
171 elog(
ERROR,
"output message found after SASL exchange failure");
172
173
174
175
176 elog(
DEBUG4,
"sending SASL challenge of length %d", outputlen);
177
180 else
182
184 }
186
187
189 {
191 }
192
194}
void sendAuthRequest(Port *port, AuthRequest areq, const char *extradata, int extralen)
#define Assert(condition)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void pfree(void *pointer)
int pq_getmessage(StringInfo s, int maxlen)
void pq_startmsgread(void)
#define AUTH_REQ_SASL_CONT
#define PqMsg_SASLResponse
#define AUTH_REQ_SASL_FIN
#define PG_SASL_EXCHANGE_FAILURE
#define PG_SASL_EXCHANGE_CONTINUE
#define PG_SASL_EXCHANGE_SUCCESS
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
void *(* init)(Port *port, const char *mech, const char *shadow_pass)
int(* exchange)(void *state, const char *input, int inputlen, char **output, int *outputlen, const char **logdetail)
void(* get_mechanisms)(Port *port, StringInfo buf)
References appendStringInfoChar(), Assert, AUTH_REQ_SASL, AUTH_REQ_SASL_CONT, AUTH_REQ_SASL_FIN, buf, StringInfoData::data, DEBUG4, elog, ereport, errcode(), errmsg(), ERROR, pg_be_sasl_mech::exchange, pg_be_sasl_mech::get_mechanisms, pg_be_sasl_mech::init, initStringInfo(), input, StringInfoData::len, pg_be_sasl_mech::max_message_length, output, pfree(), PG_SASL_EXCHANGE_CONTINUE, PG_SASL_EXCHANGE_FAILURE, PG_SASL_EXCHANGE_SUCCESS, port, pq_getbyte(), pq_getmessage(), pq_getmsgbytes(), pq_getmsgend(), pq_getmsgint(), pq_getmsgrawstring(), pq_startmsgread(), PqMsg_SASLResponse, sendAuthRequest(), STATUS_EOF, STATUS_ERROR, and STATUS_OK.
Referenced by CheckPWChallengeAuth().