id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c161300
if prettify { encoder.SetIndent("", strings.Repeat(" ", 2)) } return encoder.Encode(c) }
c161301
err } for _, pass := range c.users { if pass.passwordType() == passwordTypeBcrypt { return true, nil } } return false, nil }
c161302
off; not auditing...") return nil, nil } lock := a.locktab.AcquireOnName(mctx.Ctx(), mctx.G(), teamID.String()) defer lock.Release(mctx.Ctx()) return a.boxAuditTeamLocked(mctx, teamID) }
c161303
queueItem, err := a.popRetryQueue(mctx) if err != nil { return nil, err } if queueItem == nil { mctx.Debug("Retry queue empty, succeeding vacuously") return nil, nil } return a.BoxAuditTeam(mctx, (*queueItem).TeamID) }
c161304
teamID, err := randomKnownTeamID(mctx) if err != nil { return nil, err } if teamID == nil { mctx.Debug("No known teams to audit in db, skipping box audit") return nil, nil } return a.BoxAuditTeam(mctx, *teamID) }
c161305
merkleSeqno, err := merkleSeqnoAtGenerationInception(mctx, team.chain()) if err != nil { return nil, err } return calculateSummaryAtMerkleSeqno(mctx, team, merkleSeqno, true) }
c161306
} sigchainSeqno := ptk.Seqno root := teamchain.GetMerkleRoots()[sigchainSeqno] return root.Seqno, nil }
c161307
= CommandHelpTemplate cli.SubcommandHelpTemplate = SubcommandHelpTemplate }
c161308
err = json.Unmarshal([]byte(link), &res) return res, err }
c161309
if err != nil { return nil, err } m.Debug("findDeviceKeys: got device encryption key") m.Debug("findDeviceKeys: getting device signing key") parg.Ska.KeyType = libkb.DeviceSigningKeyType sigKey, err := m.G().Keyrings.GetSecretKeyWithPrompt(m, parg) if err != nil { return nil, err } m.Debug("findDeviceKeys:...
c161310
if err != nil { m.Debug("ckf.GetEncryptionSubkeyForDevice(%s) error: %s", bdev.ID, err) continue } m.Debug("paper key device %s encryption kid: %s", bdev.ID, ek.GetKID()) if sk.GetKID().Equal(sigKey.GetKID()) && ek.GetKID().Equal(encKey.GetKID()) { m.Debug("paper key device %s matches generated paper k...
c161311
err != nil { return 0, dummy, err } // Now try to decrypt with the unlocked device key msg, _, err := encKey.DecryptFromString(ctext) if err != nil { return 0, dummy, err } clientHalf, err := libkb.NewLKSecClientHalfFromBytes(msg) if err != nil { return 0, dummy, err } return libkb.PassphraseGeneratio...
c161312
innerReader, codec: &encoderCodecShim{NewEncoder(encKey, signKey, signaturePrefix, nonce)}, } }
c161313
nonce) output := encoder.Write(plaintext) output = append(output, encoder.Finish()...) return output }
c161314
{ return DefaultHashType, RawDefaultHash(sha256.Sum256(p)) }
c161315
:= RawDefaultHash{} copy(hashCopy[:], rdh[:]) return &hashCopy }
c161316
HashFromBytes(append([]byte{byte(hashType)}, rawHash...)) }
c161317
if !h.IsValid() { return Hash{}, errors.WithStack(InvalidHashError{h}) } return h, nil }
c161318
Hash{}, errors.WithStack(err) } return HashFromBytes(data) }
c161319
return HashFromRaw(hashType, rawHash[:]) }
c161320
_, rawHash := DoRawDefaultHash(buf) return HashFromRaw(ht, rawHash[:]) }
c161321
if len(h.h) > MaxHashByteLength { return false } if h.hashType() == InvalidHash { return false } return true }
c161322
return nil, errors.WithStack(InvalidHashError{h}) } return []byte(h.h), nil }
c161323
} h.h = string(data) if !h.IsValid() { err := InvalidHashError{*h} *h = Hash{} return errors.WithStack(err) } return nil }
c161324
if h != expectedH { return errors.WithStack(HashMismatchError{expectedH, h}) } return nil }
c161325
err != nil { return err } *h = newH return nil }
c161326
:= HashFromRaw(DefaultHashType, mac.Sum(nil)) if err != nil { return HMAC{}, err } return HMAC{h}, nil }
c161327
return hmac.h.MarshalBinary() }
c161328
return hmac.h.UnmarshalBinary(data) }
c161329
return hmac.h.UnmarshalText(data) }
c161330
DefaultHMAC(key, buf) if err != nil { return err } if hmac != expectedHMAC { return errors.WithStack( HashMismatchError{expectedHMAC.h, hmac.h}) } return nil }
c161331
// notifications generated from this sync won't be discarded. syncCtx := context.WithValue(ctx, libfs.CtxAppIDKey, nil) err = f.folder.fs.config.KBFSOps().SyncFromServer( syncCtx, folderBranch, nil) if err != nil { return err } f.folder.fs.NotificationGroupWait() resp.Size = len(req.Data) return nil }
c161332
(err error) { err = c.Cli.Call(ctx, "keybase.1.rekeyUI.refresh", []interface{}{__arg}, nil) return }
c161333
(err error) { err = c.Cli.Notify(ctx, "keybase.1.rekeyUI.rekeySendEvent", []interface{}{__arg}) return }
c161334
ei.Ctime) a.Uid = uint32(os.Getuid()) if a.Mode, err = f.writePermMode(ctx, node, a.Mode); err != nil { return err } return nil }
c161335
d.folder.fs.config.MaybeFinishTrace(ctx, err) }() return d.folder.access(ctx, r) }
c161336
in situation 1 as described in libkbfs/delayed_cancellation.go err = libcontext.EnableDelayedCancellationWithGracePeriod( ctx, d.folder.fs.config.DelayedCancellationGracePeriod()) if err != nil { return err } return d.attr(ctx, a) }
c161337
the // Attr can result in EINTR which application does not expect. This caches // the EntryInfo for the created node and allows the subsequent Attr call to // use the cached EntryInfo instead of relying on a new Stat call. if reqID, ok := ctx.Value(CtxIDKey).(string); ok { child.eiCache.set(reqID, ei) } d.fol...
c161338
}() // This fits in situation 1 as described in libkbfs/delayed_cancellation.go err = libcontext.EnableDelayedCancellationWithGracePeriod( ctx, d.folder.fs.config.DelayedCancellationGracePeriod()) if err != nil { return nil, err } newNode, _, err := d.folder.fs.config.KBFSOps().CreateDir( ctx, d.node, req...
c161339
1 as described in libkbfs/delayed_cancellation.go err = libcontext.EnableDelayedCancellationWithGracePeriod( ctx, d.folder.fs.config.DelayedCancellationGracePeriod()) if err != nil { return nil, err } if _, err := d.folder.fs.config.KBFSOps().CreateLink( ctx, d.node, req.NewName, req.Target); err != nil { ...
c161340
listed in rename(), but there doesn't seem to be any suitable // error code listed for this situation either. return fuse.Errno(syscall.EIO) } err = d.folder.fs.config.KBFSOps().Rename(ctx, d.node, req.OldName, realNewDir.node, req.NewName) switch e := err.(type) { case nil: return nil case libkbfs.Rena...
c161341
// node will be removed from Folder.nodes, if it is there in the // first place, by its Forget if req.Dir { err = d.folder.fs.config.KBFSOps().RemoveDir(ctx, d.node, req.Name) } else { err = d.folder.fs.config.KBFSOps().RemoveEntry(ctx, d.node, req.Name) } if err != nil { return err } return nil }
c161342
So bazil.org/fuse will // generate a random one for each entry, but doesn't store // it anywhere, so it's safe. } switch ei.Type { case data.File, data.Exec: fde.Type = fuse.DT_File case data.Dir: fde.Type = fuse.DT_Dir case data.Sym: fde.Type = fuse.DT_Link } res = append(res, fde) } d...
c161343
things we don't need to explicitly handle valid &^= fuse.SetattrLockOwner | fuse.SetattrHandle if valid.Uid() || valid.Gid() { // You can't set the UID/GID on KBFS directories, but we don't // want to return ENOSYS because that causes scary warnings on // some programs like mv. Instead ignore it, print a deb...
c161344
situation 1 as described in libkbfs/delayed_cancellation.go err = libcontext.EnableDelayedCancellationWithGracePeriod( ctx, d.folder.fs.config.DelayedCancellationGracePeriod()) if err != nil { return err } return d.folder.fs.config.KBFSOps().SyncAll(ctx, d.node.GetFolderBranch()) }
c161345
cr.currInput.merged { return false } if cr.currCancel != nil { cr.currCancel() } return true }
c161346
if cr.currCancel != nil { cr.currCancel() } }
c161347
input: %v", ci) cr.resolveGroup.Done() continue } waitChan := prevCRDone prevCRDone = make(chan struct{}) // closed when doResolve finishes go func(ci conflictInput, done chan<- struct{}) { defer cr.resolveGroup.Done() defer close(done) // Wait for the previous CR without blocking any // Res...
c161348
:= conflictInput{unmerged, merged} func() { cr.inputLock.Lock() defer cr.inputLock.Unlock() // Cancel any running CR before we return, so the caller can be // confident any ongoing CR superseded by this new input will be // canceled before it releases any locks it holds. // // TODO: return early if this...
c161349
because the previous CR failed to flush due to a // conflict). cr.currInput = conflictInput{} }
c161350
cr.currInput.merged = rev // Take the lock right away next time if either there are lots of // unmerged revisions, or this is a local squash and we won't // block for very long. // // TODO: if there are a lot of merged revisions, and they keep // coming, we might consider doing a "partial" resolution, writing ...
c161351
len(sp[i].Path) > len(sp[j].Path) }
c161352
sp[j], sp[i] = sp[i], sp[j] }
c161353
cr.fbo.blocks.GetEntry(ctx, lState, kmd, mergedPath) if _, noExists := errors.Cause(err).(idutil.NoSuchNameError); noExists { return false, nil } else if err != nil { return false, err } kmd = unmergedChains.mostRecentChainMDInfo unmergedPath := data.Path{ FolderBranch: mergedCop.getFinalPath().FolderBranc...
c161354
if !ok { return nil, fmt.Errorf("findCreatedDirsToMerge: No unmerged chain "+ "for most recent %v", unmergedPath.TailPointer()) } newPaths, err := cr.checkPathForMerge(ctx, unmergedChain, unmergedPath, unmergedChains, mergedChains) if err != nil { return nil, err } newUnmergedPaths = append(new...
c161355
nil { return err } if len(infos) > 0 { cr.log.CDebugf(ctx, "Adding child pointers for recreated "+ "file %s", currPath) for _, info := range infos { op.AddRefBlock(info.BlockPointer) } } return nil }
c161356
!= nil { return nil, err } chain, ok := unmergedChains.byOriginal[origTargetPtr] if !ok { return nil, fmt.Errorf("recreateOp for %v has no chain", origTargetPtr) } if len(chain.ops) == 0 { newUnmergedPaths = append(newUnmergedPaths, rop.getFinalPath()) } chain.ops = append([]op{rop}, chain....
c161357
// It was only renamed in the old parent, so // use the old parent and original name. parentOriginal = info.originalOldParent name = info.oldName } chain, ok := mergedChains.byOriginal[parentOriginal] if !ok { return fmt.Errorf("Couldn't find chain for parent %v "+ "of mer...
c161358
continue } if !mergedPath.IsValid() { cr.log.CWarningf(ctx, "Ignoring invalid merged path for %v "+ "(original=%v)", unmergedMostRecent, original) continue } actions, err := unmergedChain.getActionsToMerge( ctx, cr.config.ConflictRenamer(), mergedPath, mergedChain) if err != nil { return ...
c161359
FolderBranch: cr.fbo.folderBranch, Path: []data.PathNode{{ BlockPointer: chain.mostRecent}}, }) added = true } } if cop.Type == data.Dir || len(cop.Refs()) == 0 { continue } // Add any direct file blocks too into each create op, // which originated in later un...
c161360
ctx, cr.config.Codec(), cr.config, []chainMetadata{rootMetadataWithKeyAndTimestamp{md, session.VerifyingKey, cr.config.Clock().Now()}}, &cr.fbo.blocks, false) if err != nil { return nil, err } // If there are no renames, we don't need to fix any of the paths if len(resolvedChains.renamedOriginals) == 0 ...
c161361
newOps, err := cr.getOpsForLocalNotification( ctx, lState, md, unmergedChains, mergedChains, updates) if err != nil { return err } cr.log.CDebugf(ctx, "Local notifications: %v", newOps) if writerLocked { return cr.fbo.finalizeResolutionLocked( ctx, lState, md, bps, newOps, blocksToDelete) } return c...
c161362
case tlf.Public: pathType = PublicPathType case tlf.SingleTeam: pathType = SingleTeamPathType default: panic(fmt.Sprintf("Unknown tlf path type: %d", t)) } return BuildCanonicalPath(pathType, paths...) }
c161363
BuildCanonicalPathForTlfType(t, string(tlfName)) }
c161364
BuildCanonicalPathForTlfType(tlf.Type(), paths...) }
c161365
= c.Cli.CallCompressed(ctx, "gregor.1.incoming.consumeMessageMulti", []interface{}{__arg}, nil, rpc.CompressionGzip) return }
c161366
= v.G().UI.GetTerminalUI().PromptYesNo(PromptDescriptorPGPGenPushSecret, "Push an encrypted copy of your new secret key to the Keybase.io server?", libkb.PromptDefaultYes) if err != nil { return err } } if v.arg.DoExport { v.arg.ExportEncrypted, err = v.G().UI.GetTerminalUI().PromptYesNo(PromptDescriptorPGP...
c161367
rki.resetSeqno, rki.isReset }
c161368
rki.resetSeqno = seqno rki.isReset = isReset }
c161369
copyUI.RevokedVerifyingKeys[k] = v } copyUI.RevokedCryptPublicKeys = make( map[kbfscrypto.CryptPublicKey]RevokedKeyInfo, len(ui.RevokedCryptPublicKeys)) for k, v := range ui.RevokedCryptPublicKeys { copyUI.RevokedCryptPublicKeys[k] = v } return copyUI }
c161370
jsonErrors[i].Error = e.Error.Error() jsonErrors[i].Stack = convertStack(e.Stack) } data, err := PrettyJSON(jsonErrors) var t time.Time if len(errors) > 0 { t = errors[len(errors)-1].Time } return data, t, err } }
c161371
} s = append(s, byte(c)) } return string(s) }
c161372
error { return err }, "Merge")() return s.MergeHelper(ctx, convID, uid, msgs, nil) }
c161373
} mvalid.ServerHeader.SupersededBy = expunge.Basis // Can be 0 msgPurged, assets := s.purgeMessage(mvalid) allPurged = append(allPurged, msg) allAssets = append(allAssets, assets...) writeback = append(writeback, msgPurged) } // queue asset deletions in the background s.assetDeleter.DeleteAssets(ctx, ui...
c161374
if ierr != nil { return MiscError{Msg: "unable to get secret key: " + ierr.Error()} } ctx, err = s.engine.Init(ctx, key, convID, uid) if err != nil { return err } var msgIDs []chat1.MessageID for m := upthrough; m > 0; m-- { msgIDs = append(msgIDs, m) } return s.engine.ClearMessages(ctx, convID, uid, m...
c161375
{ for _, reactionID := range reactionIDs { if reactionID == msgid { return reactionIDs, false } } return append(reactionIDs, msgid), true }
c161376
reactionIDs := []chat1.MessageID{} for _, msgID := range mvalid.ServerHeader.ReactionIDs { if msgID != reactionMsg.GetMessageID() { reactionIDs = append(reactionIDs, msgID) } } updated := len(mvalid.ServerHeader.ReactionIDs) != len(reactionIDs) mvalid.ServerHeader.ReactionIDs = reactionIDs newMsg ...
c161377
var emptyReactions chat1.ReactionMap mvalid.Reactions = emptyReactions return chat1.NewMessageUnboxedWithValid(mvalid), assets }
c161378
{ oc.RefBlocks = append(oc.RefBlocks, ptr) }
c161379
oc.RefBlocks = append(oc.RefBlocks[:i], oc.RefBlocks[i+1:]...) break } } }
c161380
{ oc.UnrefBlocks = append(oc.UnrefBlocks, ptr) }
c161381
oc.UnrefBlocks = append(oc.UnrefBlocks[:i], oc.UnrefBlocks[i+1:]...) break } } }
c161382
be zero, if we're building an op that // will be fixed up later. bu := blockUpdate{oldPtr, newPtr} oc.Updates = append(oc.Updates, bu) }
c161383
Ops embedding this that can be converted should override this. return nil }
c161384
don't have an end") } return w.Off + w.Len }
c161385
* uint64(len(gco.UnrefBlocks)) }
c161386
+= gco.stringWithRefs(indent) return res }
c161387
isFile bool) (crAction, error) { return nil, nil }
c161388
syncOpCode) codec.RegisterType(reflect.TypeOf(setAttrOp{}), setAttrOpCode) codec.RegisterType(reflect.TypeOf(resolutionOp{}), resolutionOpCode) codec.RegisterType(reflect.TypeOf(rekeyOp{}), rekeyOpCode) codec.RegisterType(reflect.TypeOf(GCOp{}), gcOpCode) codec.RegisterIfaceSliceType(reflect.TypeOf(opsList{}), op...
c161389
LogUI: h.getLogUI(arg.SessionID), SessionID: arg.SessionID, } eng := engine.NewAccountReset(h.G(), arg.UsernameOrEmail) m := libkb.NewMetaContext(ctx, h.G()).WithUIs(uis) return engine.RunEngine2(m, eng) }
c161390
mctx := libkb.NewMetaContext(ctx, h.G()) return libkb.CancelResetPipeline(mctx) }
c161391
int, element *goquery.Selection) { results = append(results, element.Text()) }) return strings.Join(results, " ") }
c161392
element.Attr(attr) if ok { results = append(results, res) } }) return strings.Join(results, " ") }
c161393
*goquery.Selection) { if len(element.Nodes) > 0 { results = append(results, element.Nodes[0].Data) } }) return strings.Join(results, " ") }
c161394
(u.Scheme == proto) && (u.User == nil) && (u.Path == "") && (u.RawPath == "") && (u.RawQuery == "") && (u.Fragment == "") && // Disallow colons. So no port, and no ipv6. (!strings.Contains(u.Host, ":")) && // Disallow any valid ip addresses. (net.ParseIP(u.Host) == nil) return ok }
c161395
"http:": "http", "https:": "https", "dns:": "dns", "http://": "http", "https://": "https", "dns://": "dns", } canon, ok := canons[s] if ok { return canon, stringsContains(allowed, canon) } return canon, false }
c161396
args, Contextified: libkb.NewContextified(g), } }
c161397
signingKey: sigKey, encryptionKey: encKey, nistFactory: NewNISTFactory(m.G(), uv.Uid, d, sigKey), secretSyncer: NewSecretSyncer(m.G()), } }
c161398
:= src.encryptionKey name := src.deviceName ctime := src.deviceCtime src.Unlock() return a.Set(m, uv, deviceID, sigKey, encKey, name, ctime) }
c161399
sigKey a.encryptionKey = encKey a.deviceName = deviceName a.deviceCtime = deviceCtime a.nistFactory = NewNISTFactory(m.G(), uv.Uid, deviceID, sigKey) a.secretSyncer = NewSecretSyncer(m.G()) return nil }