예제 #1
0
func (milter *milter) Connect(ctx uintptr, hostname string, ip net.IP) (sfsistat int8) {
	defer milterHandleError(ctx, &sfsistat)

	sess := &milterSession{
		id:        milterGetNewSessionId(),
		timeStart: time.Now(),
		persisted: false,
	}
	sess.Hostname = hostname
	sess.Ip = ip.String()
	sess.MtaHostName = m.GetSymVal(ctx, "j")
	sess.MtaDaemonName = m.GetSymVal(ctx, "{daemon_name}")

	if reverse, _ := net.LookupAddr(ip.String()); len(reverse) != 0 {
		sess.ReverseDns = reverse[0]
	}

	MilterDataIndex.addNewSession(sess)
	sessId := sess.getId()
	res := m.SetPriv(ctx, sessId)
	if res != 0 {
		panic(fmt.Sprintf("Session could not be stored in milterDataIndex"))
	}

	StatsCounters["MilterCallbackConnect"].increase(1)
	Log.Debug("%s Milter.Connect() called: ip = %s, hostname = %s", sess.milterGetDisplayId(), ip, sess.ReverseDns)

	return m.Continue
}
예제 #2
0
func (milter *milter) Eoh(ctx uintptr) (sfsistat int8) {
	defer milterHandleError(ctx, &sfsistat)

	sess := milterGetSession(ctx, true, false)
	sess.SaslSender = m.GetSymVal(ctx, "{auth_author}")
	sess.SaslMethod = m.GetSymVal(ctx, "{auth_type}")
	sess.SaslUsername = m.GetSymVal(ctx, "{auth_authen}")
	msg := sess.getLastMessage()
	msg.QueueId = m.GetSymVal(ctx, "i")

	StatsCounters["MilterCallbackEoh"].increase(1)
	Log.Debug("%s milter.Eoh() was called", sess.milterGetDisplayId())
	return
}
예제 #3
0
func (milter *milter) Helo(ctx uintptr, helo string) (sfsistat int8) {
	defer milterHandleError(ctx, &sfsistat)

	sess := milterGetSession(ctx, true, true)
	StatsCounters["MilterCallbackHelo"].increase(1)
	Log.Debug("%d Milter.Helo() called: helo = %s", sess.getId(), helo)

	sess.Helo = helo
	sess.CertIssuer = m.GetSymVal(ctx, "{cert_issuer}")
	sess.CertSubject = m.GetSymVal(ctx, "{cert_subject}")
	sess.CipherBits = m.GetSymVal(ctx, "{cipher_bits}")
	sess.Cipher = m.GetSymVal(ctx, "{cipher}")
	sess.TlsVersion = m.GetSymVal(ctx, "{tls_version}")
	sess.persist()

	return
}
예제 #4
0
func (milter *milter) Connect(ctx uintptr, hostname string, ip net.IP) (sfsistat int8) {
	defer milterHandleError(ctx, &sfsistat)

	sess := &milterSession{timeStart: time.Now()}
	sess.Hostname = hostname
	sess.Ip = ip.String()
	sess.ReverseDns = m.GetSymVal(ctx, "{client_ptr}")
	sess.MtaHostName = m.GetSymVal(ctx, "j")
	sess.MtaDaemonName = m.GetSymVal(ctx, "{daemon_name}")
	MilterDataIndex.getNewSession(sess)
	m.SetPriv(ctx, sess.getId())

	StatsCounters["MilterCallbackConnect"].increase(1)
	Log.Debug("%d Milter.Connect() called: ip = %s, hostname = %s", sess.getId(), ip, hostname)

	return m.Continue
}