• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/postfix-255/postfix/src/smtp/

Lines Matching refs:session

15 /*	void	smtp_session_free(session)
16 /* SMTP_SESSION *session;
18 /* int smtp_session_passivate(session, dest_prop, endp_prop)
19 /* SMTP_SESSION *session;
39 /* smtp_session_passivate() flattens an SMTP session so that
42 /* smtp_session_activate() inflates a flattened SMTP session
67 /* Destination specific session properties: the server is the
75 /* Endpoint specific session properties: all the features
125 SMTP_SESSION *session;
130 session = (SMTP_SESSION *) mymalloc(sizeof(*session));
131 session->stream = stream;
132 session->iterator = iter;
133 session->namaddr = concatenate(host, "[", addr, "]", (char *) 0);
134 session->helo = 0;
135 session->port = port;
136 session->features = 0;
138 session->size_limit = 0;
139 session->error_mask = 0;
140 session->buffer = vstring_alloc(100);
141 session->scratch = vstring_alloc(100);
142 session->scratch2 = vstring_alloc(100);
143 smtp_chat_init(session);
144 session->mime_state = 0;
146 if (session->port) {
147 vstring_sprintf(session->buffer, "%s:%d",
148 session->namaddr, ntohs(session->port));
149 session->namaddrport = mystrdup(STR(session->buffer));
151 session->namaddrport = mystrdup(session->namaddr);
153 session->send_proto_helo = 0;
159 session->reuse_count = 0;
163 smtp_sasl_connect(session);
167 session->tls_context = 0;
168 session->tls_retry_plain = 0;
169 session->tls_nexthop = 0;
170 session->tls = 0; /* TEMPORARY */
172 session->state = 0;
174 return (session);
179 void smtp_session_free(SMTP_SESSION *session)
182 if (session->stream) {
183 vstream_fflush(session->stream);
184 if (session->tls_context)
185 tls_client_stop(smtp_tls_ctx, session->stream,
186 var_smtp_starttls_tmout, 0, session->tls_context);
189 if (session->stream)
190 vstream_fclose(session->stream);
191 myfree(session->namaddr);
192 myfree(session->namaddrport);
193 if (session->helo)
194 myfree(session->helo);
196 vstring_free(session->buffer);
197 vstring_free(session->scratch);
198 vstring_free(session->scratch2);
200 if (session->history)
201 smtp_chat_reset(session);
202 if (session->mime_state)
203 mime_state_free(session->mime_state);
206 smtp_sasl_cleanup(session);
210 myfree((char *) session);
215 int smtp_session_passivate(SMTP_SESSION *session, VSTRING *dest_prop,
218 SMTP_ITERATOR *iter = session->iterator;
237 session->features & SMTP_FEATURE_DESTINATION_MASK);
240 * Encode the physical endpoint properties: all the session properties
241 * except for "session from cache", "best MX", or "RSET failure".
247 * XXX Should also record an absolute time when a session must be closed,
249 * session, and perhaps other statistics, so that we don't reuse a
250 * session too much.
256 session->reuse_count,
257 session->features & SMTP_FEATURE_ENDPOINT_MASK,
258 (long) session->expire_time);
265 smtp_sasl_passivate(endp_prop, session);
269 * Salvage the underlying file descriptor, and destroy the session
272 fd = vstream_fileno(session->stream);
273 vstream_fdclose(session->stream);
274 session->stream = 0;
275 smtp_session_free(session);
287 SMTP_SESSION *session;
295 time_t expire_time; /* session re-use expiration time */
308 msg_warn("%s: bad cached session reuse count property", myname);
313 msg_warn("%s: bad cached session features property", myname);
318 msg_warn("%s: bad cached session expiration time property", myname);
329 * cached-connection information. This is done when a session is looked
342 msg_warn("%s: missing cached session destination property", myname);
346 msg_warn("%s: missing cached session hostname property", myname);
350 msg_warn("%s: missing cached session address property", myname);
366 session = smtp_session_alloc(vstream_fdopen(fd, O_RDWR), iter,
368 session->features = (features | SMTP_FEATURE_FROM_CACHE);
370 session->reuse_count = ++reuse_count;
384 if (smtp_sasl_enable && smtp_sasl_activate(session, endp_props) < 0) {
385 vstream_fdclose(session->stream);
386 session->stream = 0;
387 smtp_session_free(session);
392 return (session);