コード例 #1
0
 public RemoteCollection(DavContext ctxt, Mountpoint mp) throws DavException, ServiceException {
   super(ctxt, mp);
   mRemoteOwnerId = mp.getOwnerId();
   mRemoteId = mp.getRemoteId();
   addResourceType(DavElements.E_MOUNTPOINT);
   getMountpointTarget(ctxt);
   mMailboxId = 0;
   Account target = Provisioning.getInstance().get(Key.AccountBy.id, mRemoteOwnerId);
   if (target != null && Provisioning.onLocalServer(target))
     mMailboxId = MailboxManager.getInstance().getMailboxByAccount(target).getId();
 }
コード例 #2
0
  @Override
  protected Element proxyIfNecessary(Element request, Map<String, Object> context)
      throws ServiceException {
    // if we've explicitly been told to execute here, don't proxy
    ZimbraSoapContext zsc = getZimbraSoapContext(context);
    if (zsc.getProxyTarget() != null) return null;

    // check whether we need to proxy to the home server of a target account
    Provisioning prov = Provisioning.getInstance();
    String[] xpath = getProxiedAccountPath();
    String acctId = (xpath != null ? getXPath(request, xpath) : null);
    if (acctId != null) {
      Account acct = getAccount(prov, AccountBy.id, acctId, zsc.getAuthToken());
      if (acct != null && !Provisioning.onLocalServer(acct))
        return proxyRequest(request, context, acctId);
    }

    return null;
  }
コード例 #3
0
  @Override
  public LmtpReply getAddressStatus(LmtpAddress address) {
    String addr = address.getEmailAddress();

    try {
      Provisioning prov = Provisioning.getInstance();
      Account acct = prov.get(AccountBy.name, addr);
      if (acct == null) {
        ZimbraLog.lmtp.info("rejecting address " + addr + ": no account");
        return LmtpReply.NO_SUCH_USER;
      }

      String acctStatus = acct.getAccountStatus(prov);
      if (acctStatus == null) {
        ZimbraLog.lmtp.warn("rejecting address " + addr + ": no account status");
        return LmtpReply.NO_SUCH_USER;
      }

      if (acctStatus.equals(Provisioning.ACCOUNT_STATUS_MAINTENANCE)) {
        ZimbraLog.lmtp.info("try again for address " + addr + ": account status maintenance");
        return LmtpReply.MAILBOX_DISABLED;
      }

      if (Provisioning.onLocalServer(acct)) {
        address.setOnLocalServer(true);
      } else if (Provisioning.getInstance().getServer(acct) != null) {
        address.setOnLocalServer(false);
        address.setRemoteServer(acct.getMailHost());
      } else {
        ZimbraLog.lmtp.warn("try again for address " + addr + ": mailbox is not on this server");
        return LmtpReply.MAILBOX_NOT_ON_THIS_SERVER;
      }

      if (acctStatus.equals(Provisioning.ACCOUNT_STATUS_PENDING)) {
        ZimbraLog.lmtp.info("rejecting address " + addr + ": account status pending");
        return LmtpReply.NO_SUCH_USER;
      }

      if (acctStatus.equals(Provisioning.ACCOUNT_STATUS_CLOSED)) {
        ZimbraLog.lmtp.info("rejecting address " + addr + ": account status closed");
        return LmtpReply.NO_SUCH_USER;
      }

      if (acctStatus.equals(Provisioning.ACCOUNT_STATUS_ACTIVE)
          || acctStatus.equals(Provisioning.ACCOUNT_STATUS_LOCKOUT)
          || acctStatus.equals(Provisioning.ACCOUNT_STATUS_LOCKED)) {
        return LmtpReply.RECIPIENT_OK;
      }

      ZimbraLog.lmtp.info("rejecting address " + addr + ": unknown account status " + acctStatus);
      return LmtpReply.NO_SUCH_USER;

    } catch (ServiceException e) {
      if (e.isReceiversFault()) {
        ZimbraLog.lmtp.warn("try again for address " + addr + ": exception occurred", e);
        return LmtpReply.MAILBOX_DISABLED;
      } else {
        ZimbraLog.lmtp.warn("rejecting address " + addr + ": exception occurred", e);
        return LmtpReply.NO_SUCH_USER;
      }
    }
  }