package krb

  1. Overview
  2. Docs
A library for using Kerberos for both Rpc and Tcp communication

Install

Dune Dependency

Authors

Maintainers

Sources

krb-v0.16.0.tar.gz
sha256=353675621e4c5a888f2483dc1bb7281bd17ce4ed7dfd2f40142257f98db7c77d

doc/src/krb.public/fqdn.ml.html

Source file fqdn.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
open! Core
open Async

let localhost = "localhost"

let fqdn host =
  match%map
    Async.Unix.Addr_info.get
      ~host
      [ AI_SOCKTYPE Unix.SOCK_STREAM; AI_FAMILY Unix.PF_INET; AI_CANONNAME ]
    >>| List.map ~f:(fun (info : Core_unix.addr_info) -> info.ai_canonname)
    (* This filtering avoids using canonical names when those are not merely qualified
       versions of the host.

    *)
    >>| List.filter ~f:(fun potential_fqdn ->
      match String.chop_prefix potential_fqdn ~prefix:host with
      | None -> false
      | Some "" -> true
      | Some suffix -> String.is_prefix suffix ~prefix:".")
  with
  | [] -> Or_error.errorf "No canonical name found for [%s]" host
  | [ fqdn ] -> Ok fqdn
  | _ -> Or_error.errorf "Too many results returned for [%s]" host
;;
OCaml

Innovation. Community. Security.